in reply to User input from a command line by giving options a,b,c
Here is a selection of command-line calls and results:use warnings; use strict; use Getopt::Std; my %options; getopts('abc', \%options); while (my ($key, $value) = each %options) { print "Option: $key, value: $value\n" } print "Remaining arguments: @ARGV\n";
C:\>gash.pl -ac Option: c, value: 1 Option: a, value: 1 Remaining arguments: C:\>gash.pl -ab fred jim Option: a, value: 1 Option: b, value: 1 Remaining arguments: fred jim C:\>gash.pl -c -a fred jim Option: c, value: 1 Option: a, value: 1 Remaining arguments: fred jim
|
|---|