Content deleted Content added
Undid revision 942066967 by 2409:4055:317:F953:10AC:2FFF:FED2:A194 (talk) |
Bluelink 1 book for verifiability. [goog]) #IABot (v2.0) (GreenC bot |
||
Line 41:
This happens since the global variable $a is modified to a new ''temporary'' (local) meaning inside {{code|f()}}, but the global value is restored upon leaving the scope of {{code|f()}}.
Using <code>my</code> in this case instead of <code>local</code> would have printed 1 three times since in that case the <code>$a</code> variable would be limited to the static scope of the function {{code|f()}} and not seen by {{code|g()}}.<br /> Randal L. Schwartz and Tom Phoenix argue that the operator <code>local</code> should have had a different name like <code>save</code>.<ref>{{cite book|author=Randal L. Schwartz and Tom Phoenix|title=Learning Perl 3rd edition|at=
==Local variables in Ruby==
|