Obtain the list of keys and display each key-value pair
%presidents = ( George => "A",
Abe => "B",
Thomas => "C",
Harry => "D" );
@keys = keys( %presidents );
while ( $key = pop( @keys ) ) {
print "$key => $presidents{ $key }\n";
}
Related examples in the same category