in reply to -s and strict

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).

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me