in reply to Re: how to get a value corresponding to a key
in thread how to get a value corresponding to a key
That seems rather a long way to go about it. What does your method give you that simply using $var = $hash{$matchkey} doesn't?
Also why use $matchkey =~ /^$key$/ when $matchkey eq $key achieves the same thing without the overhead of invoking the regex engine? Regular expressions are a powerful tool, but they are often unnecessarily complex for the task in hand.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|