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).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||