Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

•Re: Thoughts on the magicality of @_ and $_

by merlyn (Sage)
on Jun 28, 2002 at 20:32 UTC ( [id://178132]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://178132]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-24 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found