On 7/12/06, David W. Schultz <[EMAIL PROTECTED]> wrote:
According to my copy of "Programming Perl",

"If you don't initialize your variables, they automatically spring into
existence with a null value that means either '' or 0 as necessary."

Which is why my change works as expected. If the --pgskip command line
option is not specified, $pgskip springs into being with a value of zero.

If you explicitly declare and initialize your variables you can use the "strict"
pragma which may catch additional errors (see the "Pragmatic Modules" chapter
in "Programming Perl" ;-).  I always use "strict" and the "-w" switch which is
why I suggested explicitly setting the variable.

I believe that the following code will also work (the way you want it to).

&GetOptions(("help" => \&usage,
             "nocopy" => \$nocopy,
             "pgskip:100" => \$pkgskip,
             "verbose" => \$verbose,
             "version" => \&version
             ));

$pkgskip = 0 unless defined $pkgskip;

(* jcl *)

P.S. I noticed that option name is pgskip and the variable name is $pkgskip.
You may want to change one or the other.

--
http://www.luciani.org


_______________________________________________
geda-user mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user

Reply via email to