The reason why I told him to use variable $a is because his entire program is only 4 lines long.
And tiny programs like that, or shell one-liners, are among the very few cases where not using strict
is a sane course of action.
You know, you might as well store it in $a. This was by no means a suggestion that it is a good practice or that we should all do this.
Then why didn't you give any warnings or other indications (aside from an emoticon, which is hardly a specific message) to indicate to the OP, who clearly appears to be relatively new to Perl (since they're not familiar with strict
or the requirements it places on your code), that it's not a good practice or that they shouldn't do it all the time? Not even a simple "you shouldn't generally do this, but, in this case, because it's so simple, you can get away with it". Just "use $a
instead of $alpha
" with no warnings at all that it might be inappropriate or dangerous in other contexts.