On Sat, Jun 15, 2002 at 06:10:23PM +0200, Robert Kasunic wrote: > Hello, > > I'm trying to use Getopt::Long for parsing parameters passed to a > function. I tried to test if that works by using the following script. > > ------------------------------------------------------- > #!/usr/bin/perl -w > use strict; > use Getopt::Long; > > sub test_params() > { > @ARGV=@_;
local @ARGV = split " ", shift; > print "ARGV: @ARGV\n"; > > my $a=0; > my $b=0; > my $c=0; > > GetOptions( "a|opta=s" => \$a, > "b" => \$b, > "c|optc" => \$c ); > > print "opta: $a\n"; > print "optb: $b\n"; > print "optc: $c\n\n\n"; > } > > &test_params("-a argument_a -b -c"); > &test_params("--opta argument_a -b -c"); > &test_params("-b"); > &test_params("-c -b"); > ------------------------------------------------------- > > Unfortunately it doesn't work. Hopefully you can work out what the problem was and why the fix works. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]