in reply to Getopts::Long -- changing its behavior
You don't mention how you initialize Getopt::Long, but you should be able to define 'file' as a boolean switch rather than a value field. Running the following:
#!/usr/bin/perl use strict; use Getopt::Long; my ( $file, $name ); GetOptions( file => \$file, name => \$name ); print "File: $file\nName: $name\n";
with:
perl test_getopt.pl -file -name
produces:
File: 1 Name: 1
which sounds like what you want.
Chris
M-x auto-bs-mode
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Getopts::Long -- changing its behavior
by jonjacobmoon (Pilgrim) on Feb 06, 2002 at 04:53 UTC | |
by seattlejohn (Deacon) on Feb 06, 2002 at 07:14 UTC | |
by jonjacobmoon (Pilgrim) on Feb 06, 2002 at 14:31 UTC |