Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: Accessing Arguments inside Subroutines via @_

by roboticus (Chancellor)
on Mar 20, 2015 at 22:35 UTC ( [id://1120811]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Accessing Arguments inside Subroutines via @_
in thread Accessing Arguments inside Subroutines via @_

Since perl can do multiple assignments in one swell foop, this would work too, avoiding the temporary variable:

sub swappy { ($_[0], $_[1]) = ($_[1], $_[0]) }

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-18 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found