![]() |
|
Keep It Simple, Stupid | |
PerlMonks |
Re: what does main->{x} = 1 do?by wade (Pilgrim) |
on May 13, 2008 at 23:30 UTC ( #686403=note: print w/replies, xml ) | Need Help?? |
'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:
Then you get a 'bareword' error without the '$' and you get a 'undefined' error with the '$' -- all as expected.
-- Wade
In Section
Seekers of Perl Wisdom
|
|