Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: getting args without clobbering @ARGV

by bfdi533 (Friar)
on May 11, 2006 at 20:13 UTC ( [id://548825]=note: print w/replies, xml ) Need Help??


in reply to Re: getting args without clobbering @ARGV
in thread getting args without clobbering @ARGV

Thanks for the suggestion and for the sample code.

For me I guess "clunky and difficult to manage" comes from the Camel book, pages 452-453 where, using getops you have something like:

my $debug = 0; getopt('dlv'); if ($opt_d) { $debug = 1; } if ($opt_l) { # do something with arg l } if ($opt_v) { # do something with arg v }

To me that is not very managable. I can see from your code example and from the CPAN docs for Getopt::Long that this might actually be more workable for me.

I presume that I have to set some sort of option to be able to use "-d" rather than "-debug"?

Replies are listed 'Best First'.
Re^3: getting args without clobbering @ARGV
by Xaositect (Friar) on May 11, 2006 at 20:40 UTC

    Even better, you can support both with a simple

    GetOptions( 'debug|d' => \$debug, );


    Xaositect - Whitepages.com

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-03-28 11:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found