Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Changing local variables in subroutine by passing by reference?

by moritz (Cardinal)
on Feb 29, 2008 at 10:49 UTC ( [id://671143]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Changing local variables in subroutine by passing by reference?
in thread Changing local variables in subroutine by passing by reference?

My second example didn't uses references at all! That's the differences.

Note that normally your subs are built like this:

sub my_sub { my ($arg1, $arg2) = @_; ... }

The assignment to another variable breaks the alias, so if you change $arg1, @_ will not be modified. But if you modify @_ directly,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-14 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found