On Wed, 30 Jan 2002 21:47:15 -0000, Angus Laycock wrote: > ------=_NextPart_000_01D4_01C1A9D7.AEC826A0 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > Hi, > > I wrote this today on UNIX . When I tested the script, calling it with > all the options (f s D P U S e q ) the "-s" option would not return the > value from the command line. All the other variables got populated. I > then change the "s:s" to "f:s" and that worked. I am trying to replace > some software which uses -s as an option and need to handle the options > the same in the PERL replacement. Is there a bug with "s:s"? >
By default, Getopt::Long is case insensitive. Try adding the "bundling" and "ignore_case" options. cf perldoc Getopt::Long (Configuring Getopt::Long) #!/usr/bin/perl -w use strict; use Getopt::Long qw(GetOptions); Getopt::Long::Configure ("bundling", "ignore_case"); my($DATABASE, $PASSWORD, $USER, $SERVER, $ERR, $SPROC, $QUERY, $TT) =('')x8; GetOptions( 'f:s' => \$TT, 's:s' => \$SPROC, 'D:s' => \$DATABASE, 'P:s' => \$PASSWORD, 'U:s' => \$USER, 'S:s' => \$SERVER, 'e' => \$ERR, 'q:s' => \$QUERY ) || die "Options incorrect\n"; print <<"_EOT_"; DATABASE = $DATABASE PASSWORD = $PASSWORD USER = $USER SERVER = $SERVER ERR = $ERR SPROC = $SPROC QUERY = $QUERY TT = $TT _EOT_ __END__ -- briac << dynamic .sig on strike, we apologize for the inconvenience >> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]