http://qs1969.pair.com?node_id=906209


in reply to How to print key and value of hash in a list

You could also use the each function, which returns the next key and value pair of the hash, eg.

my %hash = ( 'apple' => 'red', 'banana' => 'yellow', ); while( my( $key, $value ) = each %hash ){ print "$key: $value\n"; }

See each for more info.