3 ms·
> I have to add "my" to a variable to get reasonably-sane scoping, the default is that everything's global To be precise if strict is not enabled then any vari
by draegtun 15y ago
> I have to add "my" to a variable to get reasonably-sane scoping, the default is that everything's global
To be precise if strict is not enabled then any variable declared without a "my" becomes a package variable.
With use strict enabled then any variable declared without my, our or state will give a compilation error.
> Perl's defaults tend more to the insane side of the spectrum, especially in comparison with Python
Actually Perl with use strict is the sanest IMHO. Because this means that Perl avoids the sloppy (but serious) errors that can easily creep into code in languages that don't have explicit scoping / variable declaration: http://news.ycombinator.com/item?id=3087990 http://news.ycombinator.com/item?id=3087990 | http://news.ycombinator.com/item?id=3587659 http://news.ycombinator.com/item?id=3587659