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.
In reply to Re: How to print key and value of hash in a list
by kejohm
in thread How to print key and value of hash in a list
by Diane4Luo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |