Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: RFC: Idiom for named read-write arguments (aliases) instead of using $_[0] etc

by BrowserUk (Pope)
on Sep 01, 2012 at 21:48 UTC ( #991199=note: print w/ replies, xml ) Need Help??


in reply to RFC: Idiom for named read-write arguments (aliases) instead of using $_[0] etc

Essentially the same trick was employed nine years ago by Juerd for his Non-destructive array processing.

And I reused it 9 months later in Re: Re: reference to an array slice?.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong


Comment on Re: RFC: Idiom for named read-write arguments (aliases) instead of using $_[0] etc
Re^2: RFC: Idiom for named read-write arguments (aliases) instead of using $_[0] etc
by LanX (Canon) on Sep 01, 2012 at 22:13 UTC
    well using parts of it doesn't make it an idiom or pattern.

    can't see any \( ) in juerd's code and the other examples look like obfuscation contest for me not like an advice for an idiom.

    Cheers Rolf

      Looking again, I see you are right. Whilst related, they are not the same usage.

      By way of penance:

      sub swap{ our($a,$b); local( *a, *b ) = \( @_ ); ($a, $b ) = ( $b, $a ) } my( $x, $y ) = ( 1, 'fred' ); swap( $x, $y ); print "$x, $y";; fred, 1 print swap( 1, 'fred' );; fred 1

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

        good point, since $a and $b are magical globals you can even avoid the our-decalaration (in this case)

        Cheers Rolf

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2014-10-26 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls