Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by moritz (Cardinal)
on Feb 29, 2008 at 10:49 UTC ( #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 browsing the Monastery: (8)
As of 2023-12-05 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (27 votes). Check out past polls.

    Notices?