use vars qw< $x >; { my $x= 'one'; *x= \$x; for my $x ( $x ) { $x= 'two'; } } print $x;