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 :)
In reply to Re: Is using '-s' really bad and why?
by belden
in thread Is using '-s' really bad and why?
by Rhys
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |