Keys function is used to get all keys in a hash
#!/usr/bin/perl -w
use strict;
my %where = (
G => "Dallas",
L => "Exeter",
I => "Reading",
S => "Oregon"
);
foreach (keys %where) {
print "$_ lives in $where{$_}\n";
}
Related examples in the same category