in reply to Parsing NE Command Line Arguments
I was in such situation several times, and mostly ended up adding negation (or other modifier) to the parameter itself, then post-processing it with regexp or something. I.e.
use warnings; use strict; use Getopt::Long; my $foo; GetOptions( "foo=s" => \$foo, ); if ($foo) { print $foo =~ /!(.*)/ ? "All but $1" : "Only $foo"; };
bash$ perl all-but-foo.pl --foo 4 Only 4 bash$ perl all-but-foo.pl --foo \!4 All but 4
|
|---|