programming-examples/perl/Hash/Associative arrays are indexed by string values.pl

8 lines
190 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/local/bin/perl -w
my %cities = ("Toronto" => "East", "Calgary" => "Central", "Vancouver" => 'West');
for $key (keys %cities)
{
print "Key: $key Value: $cities{$key} \n";
}