programming-examples/perl/Hash/Iterate hash.pl

12 lines
214 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl
use strict;
use warnings;
my %hash = ('Key1' => 'Value1', 'Key2' => 'Value2');
print "$_ => $hash{$_} \n" foreach keys %hash;
foreach (sort values %hash) {
print "Value: $_ \n";
}