The $z variable that gets set is a package variable (actually $main::z). When you talk about predefining $z I'm guessing that you are talking about using my $z; This declares a new lexical variable called $z which is different to the package variable - hence the errors you're seeing.
To get round it, you need to predeclare $z as a package variable:
use vars qw($z);
or always refer to $z using its fully qualified name - $main::tt (actually just $::tt will do).
--
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
In reply to Re: -s and strict
by davorg
in thread -s and strict
by magnus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |