in reply to Re: Re: Re: Lexical::Alias & subroutines
in thread Lexical::Alias & subroutines

But it is not the same. Your code creates a copy. So the changes to $x do not affect the parameters to foo().

Lexical::TypeGlob doesn't seem to be related.

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Edit by castaway: Closed small tag in signature

  • Comment on Re: Re: Re: Re: Lexical::Alias & subroutines

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Lexical::Alias & subroutines
by BrowserUk (Patriarch) on May 19, 2003 at 17:08 UTC

    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

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller