1 |
Note differences between my() and local()
|
2 |
my($x); # declares $x to be private to the block
|
3 |
local($x); # declares $x to be known to this block and all routines invoked within the block
|
4 |
Typeglob or symbolic reference can be used to pass arguments by reference and not by value
|
5 |
This has usual advantage that subroutine alters "global" and not a "local" copy -- especially relevant for complex data structures where you do not want expense of copying
-
Scalars are always passed by reference (not by value); by explicitly changing $_[0..], you can affect global scalars
|