in reply to Hash with three keys

foreach my $key3 (sort keys  %{$hash{$hash{$key1}} }       ){ ... }

This may serve you better (untested):
    foreach my $key3 (sort keys %{ $hash{$key1}{$key2} }) { ... }
Also note that with Perl version 5.14+, keys et al will take a hash reference directly: see  keys EXPR

Replies are listed 'Best First'.
Re^2: Hash with three keys
by Jeri (Scribe) on Dec 12, 2013 at 21:18 UTC
    thanks everyone. got it working :)