Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Is using '-s' really bad and why?

by belden (Friar)
on Oct 19, 2004 at 20:58 UTC ( #400668=note: print w/replies, xml ) Need Help??

in reply to Is using '-s' really bad and why?

I occassionally use -s in one-off programs. Once I find myself setting more than 3 vars with -s, I switch over to something more suited to the task - usually Getopt::Long, since I like its flexibility.

At one point I was (ab)using -s so much that I wrote a silly module to parse the variables set by -s. The module is pretty boring; code that used it looked like this:

#!/usr/bin/perl -s use Getopt::Sparse; our ( $foo, $bar ) ; # set on command line sparse( foo => [ qw( f foo -foo --foo ) ], bar => [ qw( b bar -bar --bar ) ], ); print "foo: $foo\nbar: $bar\n" ;

I've currently got one script that uses that module: the test script for the module.

Fortunately I've found better things to waste my time on these days :)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2020-12-06 01:44 GMT
Find Nodes?
    Voting Booth?
    How often do you use taint mode?

    Results (65 votes). Check out past polls.