When dealing with a large hash (the OP stated this was a small example) it may be better to use each rather than getting the overhead of a temporary list using keys. A skelton example:
while (my ($key,$value) = each %$hashref) {
print "$key $value\n";
}