An extended example:
#!/usr/bin/perl
use strict;
use warnings;
my $hash = {}; # hash ref
#populate hash
push @{ $hash->{1} }, 'good';
push @{ $hash->{1} }, 'bad';
push @{ $hash->{2} }, 'bad';
my @keys = keys %{ $hash }; # get hash keys
foreach my $key (@keys) { # crawl through hash
print "$key: ";
my @list = @{$hash->{$key}}; # get list associate within this key
foreach my $item (@list) { # iterate through items
print "$item ";
}
print "\n";
}
output:
1: good bad
2: bad