in reply to Getopts::[Std|Long]. How define a option -L1
Getopt::Std has the functionality you need:
#! perl use strict; use warnings; use Getopt::Std; our ($opt_p, $opt_L); getopts('p:L'); # -p takes an argument, -L is a boolean flag print "p switch: $opt_p\n"; print "L switch: $opt_L\n";
Output:
16:01 >perl 698_SoPW.pl -L -p foo p switch: foo L switch: 1 16:01 >
As this is a core module, it’s also documented in the Perl documentation: Getopt::Std.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getopts::[Std|Long]. How define a option -L1
by Pazitiff (Novice) on Aug 27, 2013 at 06:21 UTC | |
by Athanasius (Archbishop) on Aug 27, 2013 at 06:48 UTC | |
by Anonymous Monk on Aug 27, 2013 at 07:28 UTC | |
by Pazitiff (Novice) on Aug 28, 2013 at 06:36 UTC |