in reply to How to access contents of a reference to a hash.

There is the easy way:

print $hashref->{hello};

That easy way is not enough if you need something like the "original hash" %hash:

print join "\n", sort keys %{$hashref};

Most likely, tyes References quick reference will be of help when you're dealing with references.

Update: As ambrus points out, I didn't read your code close enough - you are initializing the hash wrong. Assign a list to the hash, not a hash reference:

my %hash = ( hello => 'world', foo => 'bar', );