The stupid question is the question not asked | |
PerlMonks |
Re: Initializing a hash using a foreach loopby Roy Johnson (Monsignor) |
on Nov 29, 2004 at 19:37 UTC ( [id://411023]=note: print w/replies, xml ) | Need Help?? |
You're re-assigning the whole hash every time. Try:
I've also removed unnecessary quotes and converted to a more Perlesque foreach loop. An alternative method would be to use map to assign the whole hash:
Caution: Contents may have been coded under pressure.
In Section
Seekers of Perl Wisdom
|
|