http://www.perlmonks.org?node_id=686403


in reply to what does main->{x} = 1 do?

'main' can be a hash ref, or an array, or whatever -- differentiated by the character in front and what's been put in there (I'm a little shaky on the Perl internals). The code that you had, in order to print '1' needed to have a '$' in front of the 'main' in the first line.

Now, if you:

use strict; use warnings; use diagnostics;

Then you get a 'bareword' error without the '$' and you get a 'undefined' error with the '$' -- all as expected.

--
Wade