in reply to Re: Re: Re: Re: Lexical::Alias & subroutines
in thread Lexical::Alias & subroutines
Right you are. I'm not having a good thread am I.
Maybe this will make up for it -- but then again...
#! perl -slw use strict; sub doit{ our $scalar; local *scalar = ($_[0] eq 'first' ? \$_[1] : \$_[2]); $scalar = 'new value'; } sub double'em{ our @array; local *array = $_[0]; $_ *= 2 for @array; } my ($x, $y) = ('old value') x 2; doit 'first', $x, $y; print "$x, $y"; my @a = 1 .. 10; double'em \@a; print "@a"; __END__ D:\Perl\test>temp new value, old value 2 4 6 8 10 12 14 16 18 20
|
|---|