my %h = ( 'a' => 1, 'b' => 2, 'c' => 3, ); print_hash(\%h); sub print_hash { my $h = shift; for (keys %$h) { print "$_: $h->{$_}\n"; } }