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