in reply to Passing switches through pl2bat scripts
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing switches through pl2bat scripts
by demerphq (Chancellor) on Nov 17, 2003 at 16:19 UTC | |
by flounder99 (Friar) on Nov 17, 2003 at 17:17 UTC | |
by demerphq (Chancellor) on Nov 17, 2003 at 18:02 UTC |