in reply to Perl Input Parameters for Unix
You can also use 5.010 and process arguments in "switch-case" style.my ($input,$stat,$csv); while (my $arg = shift @ARGV) { if ($arg eq "-i") { $input = shift @ARGV; } elsif ($arg eq "-s") { $stat = shift @ARGV; } elsif ($arg eq "-o") { $csv = shift @ARGV; } else { die "$arg: invalid argument\n"; } defined $input && defined $csv && defined $stat || die "You should def +ine -i, -o and -s!\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Input Parameters for Unix
by monsoon (Pilgrim) on Jul 09, 2012 at 16:31 UTC | |
|
Re^2: Perl Input Parameters for Unix
by Anonymous Monk on Jul 10, 2012 at 04:49 UTC | |
by aitap (Curate) on Jul 10, 2012 at 07:13 UTC |