But if there's only one such construction in a Perl program, which approach incurs more overhead?
- the single nasty temporary variable, or
- loading a CPAN module that is used only once, to replace that variable with, to be frank, somewhat clunky syntax for accessing the outer $_ in the inner map
And are there two different answers if you define "overhead" in terms of the burden on Perl versus the burden on the human brain reading the code? (To reduce brain overhead, at least the temporary variable can be given a meaningful name, whereas the NestedMap::stack
syntax is inherently meaningless as well as kind of ugly.)