in reply to how to get a value corresponding to a key
Why do you need to traverse the entire hash? Just go directly to that key.
my %hash = (foo => 'bar', baz => 'biff'); my $scalar = $hash{foo}; [download]
You should probably read perldoc perldata.