in reply to Trying to understand aliasing (*var)

It's called a typeglob. To get your example to work you will need a use vars qw($z) or specify the full package of the variable:

use strict; my $x=2; *main::z=\$x; print $main::z;
Not that this will not work with a lexical $z declared with my as it has to be a package variable.

/J\

Replies are listed 'Best First'.
Re^2: Trying to understand aliasing (*var)
by blazar (Canon) on Feb 11, 2005 at 12:47 UTC
    It's called a typeglob. To get your example to work you will need a use vars qw($z) or specify the full package of the variable:
    or use our $z.