On Sun, 2007-08-12 at 22:55 -0400, yitzle wrote:
> I got an array of values where the order is relevent, eg the ages of
> Alice, Bob and Charles, and I want to make a hash out of it. I got
> this code that does it:
> my %ages = (alice => $r[0], bob => $r[1], charles => $r[2]);
> Is there a more elegent way to do it?
This is not elegant in this example but it possibly is the answer you
are looking for.
my %ages{ 'alice', 'bob', 'charles'} = @r;
--
Ken Foskey
FOSS developer
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/