Perl-Sensitive Sunglasses | |
PerlMonks |
Re: How can I assign the elements in an array to only the key values in a hash?by stefp (Vicar) |
on Mar 31, 2001 at 20:59 UTC ( [id://68671]=note: print w/replies, xml ) | Need Help?? |
Q: I have an array that keeps returning matches in a string, each match must be inserted into a hash as an empty key (..) If i judge by your code, you want empty values. Anyway empty keys does not make sense. Because each key of a hash must be unique within the hash set of keys $hash{$_}= '' for @array; usually conunting number of matches for each strings makes more sense: $hash{$_}++ for @array; -- stef
In Section
Seekers of Perl Wisdom
|
|