in reply to ref to read-only alias ... why?
It appears like read-only values are not modified when aliased.
DB<123> sub tst { my $r = \ $_[0]; print ++$$r; } DB<124> $x=3; for (1,2,$x) { tst($_); print ": ",$_,"\n" } 2: 1 3: 2 4: 4
UPDATE:
Seems to me like "aliasing" read-only values is falling back to "copying".
Or in other words: Only lvalues can be "really" aliased.
Which makes sense in a way, because the original value can't be changed anyway.
Cheers Rolf
|
---|