Getopt by itself will preserve case. If you want to force all your
options to lowercase, you can map @ARGV to lowercase. For example:
use Getopt::Std;use Data::Dump qw(dump);use strict;@ARGV=map(lc,@ARGV);my
%options;getopt('odi',\%options);print dump \%options;exit;
This will map all your arguments AND parameters to lowercase. If this were
executed such as:
perl optest.pl -o 1 -D 2 -i "FooBaR"{ d => 2, i => "foobar", o => 1 }
Note specifically that "FooBaR" has also been made lowercase.
I
suggest taking a look at Getopt::Mixed, Getopt::Compact and
Getopt::Long. All of which support case-insensitive parameter matching
as an option.
Sean Tobin
[EMAIL PROTECTED]
To: [email protected]
Subject: Option in getopts to ignore case?
From: [EMAIL PROTECTED]
Date: Fri, 16 Nov 2007 08:56:03 -0600
Gurus,
I found nothing in the perldoc for Getopt::Std
that allows the getopts function to ignore case in its arguments. Is there
something hidden that will make getopts insensitive to case? Or is there
perhaps a case-ignoring alternative to this function?
Thanks!
Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150
A word to the wise ain't necessary, it's the stupid ones who need the advice.
-- Bill Cosby
_________________________________________________________________
Help yourself to FREE treats served up daily at the Messenger Café. Stop by
today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs