Note differences between my() and local();
|
my($x); # declares $x to be private to this subroutine
|
local($x); # delares $x to be known to this subroutine and all those routines that it invokes
|
Typeglob or symbolic reference can be used to pass aruments by reference and not by value
|
This has usual advantage that subroutine alters "global" and not a "local" copy -- especially relevant for complex datastructures where you do not want expense of copying
-
Scalars are always passed by reference and not by value and by explicitly changing $_[0..], you can affect global scalars
|