You can always use grep if you know what the name will be like:
But why don't you know the name of the key? That's one of the major reasons to use a hash instead of a regular array (besides using them to find unique keys). Should you be using a regular array instead?use strict; use warnings; use Data::Dumper; my %hash = ( foo => 'bar', football => 'Monday', one_thing => 'another', ); my @match = grep /^foo/, keys %hash; print Dumper \@match;
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: how to find a key from a hash
by jeffa
in thread how to find a key from a hash
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |