|
|
| The stupid question is the question not asked | |
| PerlMonks |
Re: 1 line array to hash converterby stefp (Vicar) |
| on Sep 21, 2001 at 14:39 UTC ( [id://113881]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
$hash{$_}++ for @array;
The value associated to a key is the number of elements in @array which have the value of the said key. The solution you searched for and explicited by suaveant gives 1 for each value even if the key appears many times in the array. TMTOWTDI. -- stefp
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||