programming-examples/perl/Hash/Reverse a hash.pl

17 lines
226 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl -w
use strict;
my %where = (
A => "AA",
B => "BB",
C => "CC",
D => "DD"
);
my %who = reverse %where;
foreach (keys %who) {
print "in $_ lives $who{$_}\n";
}