in reply to Re^2: Printing hash
in thread Printing hash

Quote:Secondly, $key is an alias to each value in the list, which means modifying $key will modify the original value :EndQuote

It will change the value in the list returned by keys and sort, but not in the original hash, e.g.

my %hash = (1 => 'a', 2 => 'b', 3 => 'c'); foreach my $value (sort keys %hash ) { $value--; } print join( ', ', sort keys %hash ), "\n"; # 1, 2, 3
-imran