Ah right, thanks. In which case, wouldn't the other moral of the story be: Always use strict? ;-) | [reply] [d/l] |
wouldn't the other moral of the story be: Always use strict?
I'd say moral of the story is, "use lexical variables." You don't have to use strict to do that, it just helps force your hand. Also, the word "always" is kind of dangerous, unless of course you meant the variety of "always" that is commonly -- but not always -- in effect. :-)
| [reply] |
That is indeed the variant of always I meant :-)
But personally I use non-lexical variables far more often than I do not use strict. @ARGV and $_ for example, or local $/ appear quite regularly in my code. The only times I regularly don't use strict is on one-liners or quick throwaway scripts. In which case I don't bother to lexicalize my variables either. Hmm, seeing that written down, maybe I should bother... And then there's legacy code of course, but I'd consider that code which hasn't been sufficiently refactored. So I would still say, always use strict unless you know better (in which case you don't need advice from the likes of me ;-).This node notwithstanding.
| [reply] [d/l] [select] |
/me heads to the corner store looking for sackcloths and ashes.
| [reply] |