Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by mr_mischief (Monsignor)
on Feb 01, 2016 at 18:27 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1154218]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-26 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found