Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1154218]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2018-05-21 17:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?