in reply to Re^2: Iterating over verbatim hash reference
in thread Iterating over verbatim hash reference
That duplication trick is really not nice, but I don't see a way how can this be avoided in perl5 (probably a wiser monk may shed some light on this).
Some other languages have nicer constructs for recursive anonymous functions without this trickery, look at a few examples at stackoverflow.com.
However I treated the challange of "eliminating named variables", more as a (math-like) challange of using functional programming concepts in perl5, rather than "how to achieve tha same results in real code".
update:we have just traded the name of a hash for a name of a sub [...], so it's not a real gainThat's true for the particular code above, however think of this issue more generally. If we insist on retaining the sub identifier, that still has its advantages, because in lots of code, we traded lots of hash identifiers for one sub identifier.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Iterating over verbatim hash reference
by rovf (Priest) on Jan 22, 2010 at 14:02 UTC |