3 ms·
Yeah, as opposed to perl. I have to add "my" to a variable to get reasonably-sane scoping, the default is that everything's global. Perl's defaults tend more
by jbooth 15y ago
Yeah, as opposed to perl.
I have to add "my" to a variable to get reasonably-sane scoping, the default is that everything's global.
Perl's defaults tend more to the insane side of the spectrum, especially in comparison with Python (who's entire design philosophy is a reaction to Perl). Not that there's anything wrong with that, and if you've done mostly perl I'm sure it seems natural, but compared to conventions across every other mainstream language it seems crazy.
- 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