On Wednesday 02 May 2001 11:27 pm, Randall Perry wrote:
> I'm baffled by perl's scoping of variables. In the code below, the
> $cust_data hash ref is inited outside the while loop. It's then set in the
> while with the results of a PgSQL query.
>
> In the if-else statement $cust_data can be seen in the 'if' but not in the
> 'else' (if I try to print a value in else, $cust_data->{'customer'}, I get
> an undeclared variable error).
>
> I understand that by using 'strict' I can't use any global variables.
No, my understanding is that it forces you to define variables both local and
global. I've used this statement to declare variables I need throughout a
script using strict:
use vars qw($val $var $value $conf @var_array @val_array %fields_hash);
Michelle
------------
Michelle Murrain, Ph.D.
President
Norwottuck Technology Resources
[EMAIL PROTECTED]
http://www.norwottuck.com
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]