go ahead... be a heretic | |
PerlMonks |
Re: grep keys in hash and retrieve valuesby Anonymous Monk |
on Mar 16, 2012 at 10:07 UTC ( [id://959951]=note: print w/replies, xml ) | Need Help?? |
I think my $matching_key, is returning the number of keys that match the grep and not the actual hash key. Then you should write a program to check
Yup, grep in scalar context returns the number of matches. Now in list context it returns a list :)
So to get the first from the list, we use parens
See Tutorials: Context in Perl: Context tutorial And see again Re: help with loop and start making functions, your program is very hard to read :)
In Section
Seekers of Perl Wisdom
|
|