in reply to Mixing command line arguments
Update: Added an example for positional arguments since the OP seemed to maybe have wanted that --Brianmy($help,$backup,$upd_sybase,$silent); GetOptions('help|h!' => \$help, 'b!' => \$backup, 'u!' => \$upd_sybase, 's!' => \$silent); # assuming it's always key1 value1 key2 value2 in argument list my %other_args = @ARGV; # if your arguments are positional, do this: # my($server,$password) = @ARGV; # called like this: ./foo --silent server bar password blah # yields: # $silent == 1 # $other_args{server} eq "bar"; # $other_args{password} eq "blah";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Mixing command line arguments
by Fletch (Bishop) on Nov 02, 2004 at 16:34 UTC | |
|
Re^2: Mixing command line arguments
by ikegami (Patriarch) on Nov 02, 2004 at 17:55 UTC |