Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: about perl -s switch -- usable? evil? unneeded?

by mr_mischief (Monsignor)
on Feb 01, 2016 at 18:27 UTC ( #1154218=note: print w/replies, xml ) Need Help??

in reply to about perl -s switch -- usable? evil? unneeded?

If you want an answer that like a one-liner is short, dirty, simple, and to the point: if you want things clean and maintainable don't write them as one-liners.

There is Getopt::Long if you want a clean, maintainable options mechanism. You can, although it's generally not very advisable, roll your own complex @ARGV handling. You could write some quite simple @ARGV handling, but the -s switch does that much for you. So use -s where you want very simple argument handling for a quick and dirty solution like a one-liner, and use a well-understood and widely used option handling mechanism like Getopt::Long when you are writing something to be reused and maintained.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1154218]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2018-08-16 12:45 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (167 votes). Check out past polls.