programming-examples/perl/Hash/Keys function is used to get all keys in a hash.pl

14 lines
223 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl -w
use strict;
my %where = (
G => "Dallas",
L => "Exeter",
I => "Reading",
S => "Oregon"
);
foreach (keys %where) {
print "$_ lives in $where{$_}\n";
}