Bryan R Harris wrote:
Curiously, perlvar seems to recommend localizing $_ with "local", but I
thought I read somewhere to never use local and only use my.  I still don't
understand how those two are different.


'my' variables are lexically scoped, that is, you can only use them in the block or file they are defined in. 'our' variables are globally scoped, they can be used anywhere. Only 'our' variables can be 'local'-ized, that is, a copy is saved and restored after you leave the block you 'local'-ized them in. There are also dynamic, meaning that the new version of the variable will be used in all called subroutines, even if the subroutines are in another file or package.


Makes sense.  What happened to Perl 5.9?


Odd numbered Perls are for development. If you really want to run one, you can but bugs can appear and disappear at any time. :)


--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

Regardless of how small the crowd is, there is always one in
it who has to find out the hard way that the laws of physics
apply to them too.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to