How do I find the key of a specific hash element?
[email protected] (jshock)
| Newsgroups | perl.beginners |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <723671fb-13fa-4d3c-b296-6e29a5bdfe12@f63g2000hsf.googlegroups.com> |
For example:
my %weekdays = (
0 => "SUN",
1 => "MON",
2 => "TUE",
3 => "WED",
4 => "THU",
5 => "FRI",
6 => "SAT",
);
$weekdays{2}; # gives "TUE"
But what if I know "TUE" and want to find out what the key is? Is
there a construct like $weekdays{"TUE"} that gives 2"