On Wed, Jun 20, 2001 at 03:47:31PM +0200, Christine Kluka wrote:
> Neil,
> 
> Thanks, I added "my" to this variable and to the array and hash
> declarations in my "row" subroutine -- this eliminated the "not
> imported" errors.
> 
> Now when I execute the script I am prompted for explicit package names
> for each instance of a scalar, array or hash.  I believe that if I
> declare the fully qualified package name where the database handler is
> invoked, this should take care of the problem.  I've tried several ways
> of doing this, but they all fail on syntax or for more serious reasons. 

That's another error that means you haven't declared your variables.

When you use strict 'vars', you have three options for each variable.

Declare it with my:

  my $lexical_variable;
  $lexical_variable = 7;
  print $lexical_variable;

Declare it with use vars:

  use vars qw/ $global_variable /;
  $global_variable = 7;
  print $global_variable;

Specify the package name every time you use it:

  $main::global_variable = 7;
  print $main::global_variable;

Most people prefer the first two options.

Ronald

Reply via email to