in reply to Thoughts on the magicality of @_ and $_

Is the same true if you use an intermediate variable - does it get aliased, or merely assigned?
It's weirder than that. Check this out:
my $one = "wired"; for my $two (grep 1, substr($one, 1, 3)) { sub { $_[0] = "eir" } -> ($two); } print $one;
I'm using the lvalueness of the grep, foreach, substr, and argument passing there. With a little more work, you can add the lvalueness of slices and values as well. {grin}

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
(MeowChow) Re2: Thoughts on the magicality of @_ and $_
by MeowChow (Vicar) on Jun 28, 2002 at 21:22 UTC
    More weirdness:
    my @l = 1..9; $_ = "foo" for grep $_ % 2, sort reverse @l; print "@l\n";
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print