Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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
Domain Nodelet?
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 surveying the Monastery: (2)
As of 2022-11-26 23:25 GMT
Find Nodes?
    Voting Booth?