in reply to passing hashes to a function

You might remove that first print statement in your foreach loop. It's printing $value.

I would handle things a little differently, but this assumes you're more comfortable with references than you might be at this point. Untested:

sub print_hash { my $hash_ref = shift; my $value; foreach $key (keys %$hash_ref) { $value = $hash_ref->{$key}; print "fruit: $key is $value\n\n"; } }
Instead of dereferencing the reference and copying the resulting hash (what you did with $food), this accesses the underlying hash through the reference. If you're concerned about potential modification of the hash in the subroutine, be aware that this technique could allow that.

For more details, see perlref, as it describes the %$ and $->{} syntaxes in sufficient detail. (Dereferencing)