--- "Yacketta,Ronald J" <[EMAIL PROTECTED]> wrote:
> ugh!
> my god I have no clue what these errors mean, holy crud there are a
> million!
> 
> Global symbol "g_version" requires explicit package name at ./wki.pl
> line 27
> the line is
> $g_version      =       "alpha 1.0";
> 
> looks ok to me *shrug*
> every single variable is giving me this grief :(

lol...

strict requires that you predeclare vars. It catches things like
$REPORRT further down, which I suspect is a typo.

A few suggested solutions:

 use vars qw ( $this_var @that_var %some_other );

That tells Perl that these are package globals, but that you are going
to use them by these names in this package without using the
$Full::PackName syntax.

Whenever you use a variable in Perl, it's global by default.
  $g_version      =       "alpha 1.0";
actually assigns to $main::g_version, but strict requires that you be
explicit about it, instead of just assuming you mean the current
package and creating it if there wasn't one.

You could just say $main::var every time, but that gets old quickly. In
package main, you can just say $::var, but even that is ugly.

Usually, a *better* solution is to use my():

  my $g_version  =  "alpha 1.0";

Will make strict happy, but the variable is no longer a package global;
now it only exists in the current scope (though that might be the whole
file). You can do this in a function or loop to scope a variable to
that block.




__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to