mike65535 has asked for the wisdom of the Perl Monks concerning the following question:
I want to pass a case-insensitive argument into a Perl script. I've used a construct like:
successfully.given( $ARGV[0] ) { when (/foo/i) {do this} when (/goo/i) {do that} }
However, I want to add an option to each "when" whereby the passed-in value can optionally be just a number (say 0, 1, etc.). IOW, I want to be able to call the script with any of the following constructs:
and always "{do this}".
I tried the gw[] construct but I lose the case-insensitivity
I'd appreciate some help. Thanks!given( $ARGV[0] ) { when (gw(/foo/i 0)) {do this} when (gw(/goo/i 1)) {do that} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: give/when/ usage
by hippo (Archbishop) on Dec 02, 2015 at 16:46 UTC | |
by mike65535 (Novice) on Dec 02, 2015 at 19:37 UTC |