Does anyone know of a slick way to put an array into a hash?
For example, given
%a=
(
-a => 1,
-b => 2,
-c => 3
);
@b=qw/-x 24 -y 25 -z 26/;
Is there a nice way to merge the hash implied by @b into %a to get
%a=
(
-a => 1,
-b => 2,
-c => 3,
-x => 24,
-y => 25,
-z => 26
);
without doing something like
for $i (0,2,4)
{
$a{$b[$i]}=$b[$i+1]
}
For the record,
push %a, @b;
doesn't work ;)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- Re: pushing into a hash Mooney Christophe-CMOONEY1
- Re: pushing into a hash Jeff 'japhy/Marillion' Pinyan
- Re: pushing into a hash Michael Fowler
- Re: pushing into a hash Paul
- Re: pushing into a hash Michael Fowler
