in reply to Is using '-s' really bad and why?
Well, here are some of my thoughts and attempts, some might be a good argument, others might not be (depending on the situation and the code).
First, I wondered what would happend if some of the predefined variables are changed (as in passed as an argument), but then I thought of changing variables in another package.
When I passed the argument -Abc::Def::ghi=jkl then the variable $Abc::Def::ghi was changed, at this moment I'm too lazy to find out what would happend if Abc::Def was a real package, which does rely on the value...
Now, back to the builin variables,
- Argument -[=45, nothing happend.
- Argument -,=abc: $, was changed to "abc", but "abc" wasn't used as list seperator in print @x; which means that print join $,, @x; isn't the same as print @x;
- Argument -\"=abc: $" was changed to "abc", and print "@x" was the same as join $", @x;, or in other words, the value was changed and is used.
- Argument -#=%06d (that var is deprecated but I tried it anyway): value of $# is changed but not used
- Argument -]=2.019: value changed, 'use 5.006' still uses the correct version, but if ($] < 5.006) will fail. And particulary intresting about this is that $] is a read-only value
These are just some vars from perldoc perlvar on which there probably isn't checking and can effect the output/working of the script...
But aslong as -s is used with care (as in not in public scripts which may be run by others) I don't see any problem using -s, ofcourse it is a lot safer to use a GetOpt module, which is what I usually do.
Also I don't think -s is the top hit on google, I rather think it is either one of the following: -p, -e, -n, -i or -l. (Or atleast those are the ones which I reguarally use).