Do you want a variable $hash or a hash %hash? You need to
make your declaration match what you are using it as.
In your push you are using $hash as a reference to a hash,
in your print you are looking up a value in %hash. This
will not work well since they are different things, and
that is why neither of your attempts at declaring it
managed to do away with the problem.