On Sat, 2006-03-11 at 14:40 -0800, Ben Tilly wrote:
> as follows:
> 
> while(grep(/--debug=(\d+)/, @ARGV)){
>     $debug = $1;
>     print "debug: $debug\n";
>     last;
> }

Or, of course,

        use Getopt::Long;
        our $debug=0;
        GetOptions('debug=i'=>\$debug);
        print "debug $debug\n" if $debug;

or for slightly more flexibility:

        GetOptions('d|debug=i'=>sub { $debug=$_[1]; print "$_[0]=$_[1]\n" });

which allows for:

        -d 4
        --debug 4
        --debug=4

and can even allow for

        --deb=4

if you use:

        Getopt::Long::Configure('auto_abbrev');

-- 
Aaron Sherman <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"We had some good machines, but they don't work no more." -Shriekback


 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to