gEDA-user: refdes_renum and pgskip

John Luciani jluciani at gmail.com
Wed Jul 12 19:20:44 EDT 2006


On 7/12/06, David W. Schultz <david.schultz at earthlink.net> 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


More information about the geda-user mailing list