programming-examples/perl/Hash/Sort keys in a hash.pl

7 lines
150 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$hash{fruit} = apple;
$hash{sandwich} = hamburger;
$hash{drink} = bubbly;
foreach $key (sort keys %hash) {
print "$key => $hash{$key}\n";
}