You want getopts not getopt. Because getopt is expecting a value and getopts is for binary flags. when you do aNAME getopt - Process single-character switches with switch clustering getopts - Process single-character switches with switch clustering SYNOPSIS use Getopt::Std; getopt('oDI'); # -o, -D & -I take arg. Sets $opt_* as a side e +ffect. getopt('oDI', \%opts); # -o, -D & -I take arg. Values in %opts getopts('oif:'); # -o & -i are boolean flags, -f takes an argumen +t # Sets $opt_* as a side effect. getopts('oif:', \%opts); # options as above. Values in %opts
you are setting the value of %opt{z} == "" which is false.C:\>z -z
sets the value of %opt{z} == "-z" which is evaluated as true.<code> C:\>z -z -z
Don't feel bad, I've been there and done that.
--
flounder
In reply to Re: Passing switches through pl2bat scripts
by flounder99
in thread Passing switches through pl2bat scripts
by PhilHibbs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |