On Fri, Aug 03, 2001 at 04:05:33PM +0530, Rajanikanth Dandamudi wrote:
> -------------------------------------------------
> #!/usr/local/bin/perl
> use Getopt::Long;
> 
> my $filename;
> print "Before : ARGV = @ARGV\n";
> $ret = GetOptions('abc=s' =>\$filename);
> print "Return value = $ret  ";
> print "filename = $filename\n";
> print "After : ARGV = @ARGV\n";
> -------------------------------------------------
> 
> How I expect this code to behave is to match the command line switch
> -abc. But it is matching all the swithces -a , -ab , and -abc. Can
> someone help me in understanding this. When I ran this program the
> following are the results:

This is Getopt::Long's abbreviation handling; if the switch specified is a
unique abbreviation of one of the switches in GetOptions argument list, then
it acts as if the full switch was specified.  See the section "Case and
abbreviations" in perldoc Getopt::Long.  If you want to turn this feature
off specify 'no_auto_abbrev' as an argument in a call to
Getopt::Long::Configure.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to