in reply to list values of specific hash keys

I'm going to take a stab in the dark and assume you're using strict (as you should).

That should be

foreach my $key (@keys){
Even though $key is automatically localized to the loop, you still need to declare it.

Replies are listed 'Best First'.
Re^2: list values of specific hash keys
by sorenjul (Initiate) on Feb 27, 2012 at 21:26 UTC
    Hi @keys is defined elsewhere and contains strings and declaring keys outside doesn't help. If I print $key indside the foreach loop it has the correct values, but for some reason using it in the line my $value = $hash{$key}; it doesen't work. If I enter the key manually in my $value = $hash{"1234567"}; it works. \Sorenjul