Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
But the first one doesn't work okay all the time. Sure, the month example is always going to fail. (and you can't override a builtin so it works in that context, that I know of) But someone could modify something later, and add a function whose name conflicts with one of your bare words: perl -e 'sub sat{}; @days = (sun,mon,tue,wed,thu,fri,sat); print "@days\n";' Or, you use some module that polutes your namespace when you weren't expecting it. Because Perl scripts aren't compiled, you can't be sure that the assumptions that you made at the time of writing the program (that the barewords weren't names of functions) are going to be true for the life of the script. It also doesn't help that context affects when barewords are always handled as strings:
In reply to Re: Why use strict is good, and barewords are bad
by jhourcle
|
|