![]() |
|
go ahead... be a heretic | |
PerlMonks |
Re^2: Why use references?by chas (Priest) |
on Dec 12, 2005 at 01:55 UTC ( [id://515929]=note: print w/replies, xml ) | Need Help?? |
In your "Without References" example, don't you need
return ++$arg;? (and a semicolon after shift?) Also, consider the following: which shows that args are passed "by reference" by default. Of course, it may not be good style to alter @_ in this way, but the point is that you don't need to pass a reference to alter the argument inside the sub. (Updated to make less confusing.)
In Section
Seekers of Perl Wisdom
|
|