in reply to Re^2: when is "my" not necessary?
in thread when is "my" not necessary?

my $hash; $hash{foo} = bar;
Once again, you are not using strict (and you have two different variables named 'hash'). The first line above refers to the lexical scalar variable $hash (which in your second example you use as a hash reference, which is just another type of scalar); the second line, assuming there is nothing else in this program, is referring to the package variable %main::hash. If you wanted to make a lexical hash you would go:
my %hash; $hash{foo} = 'bar';
You should use strict, as your second line also uses the bare word 'bar', which gets interpreted as a string, but is a dangerous thing to rely upon, and won't work under strict anyway (and assigining to the undeclared hash is also not allowed under strict). Maybe a look through perldata is in order.