Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by belden (Friar)
on Oct 19, 2004 at 20:58 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found