P
Pavel Smerk
Assume a big hash and/or a nested structure and the need of a plenty of
operations on some hash[...][...][...] which is Float. How can one avoid
the repetitious evaluation of the indices? I have not been able to get a
"real" reference to that variable to do _something_like_ tmp =
referenceof(hash[...][...][...]) and work with the value directly
through the (dereferenced) tmp variable. In Perl I would say
$ perl -e '$x[1][2][3] = 1; $a = \$x[1][2][3]; $$a = 3; print $x[1][2][3]'
3
(where \... is a reference and $ before $a is a dereference).
Morover, why the return value of the assignment is not an l-value? The
following is legal in Perl ($x ||= 1) *= 2 --- why it is not legal in
Ruby as well?
Thanks, P.
operations on some hash[...][...][...] which is Float. How can one avoid
the repetitious evaluation of the indices? I have not been able to get a
"real" reference to that variable to do _something_like_ tmp =
referenceof(hash[...][...][...]) and work with the value directly
through the (dereferenced) tmp variable. In Perl I would say
$ perl -e '$x[1][2][3] = 1; $a = \$x[1][2][3]; $$a = 3; print $x[1][2][3]'
3
(where \... is a reference and $ before $a is a dereference).
Morover, why the return value of the assignment is not an l-value? The
following is legal in Perl ($x ||= 1) *= 2 --- why it is not legal in
Ruby as well?
Thanks, P.