sub printElement { my ( $hash1, $key ) = @_; print "$key $hash1->{$key}\n"; ... printElement( \%hash, $key );