Repeated nested lookups happen at runtime in Perl, and you can often get signficant speedups by factoring them out of loops. Also I have found that just creating temporary variables for them makes the mechanics of the code less of a problem, and clarifies what it is doing.
BTW the original example actually created a set of reports, with different sets of fields. And some of the fields themselves were the result of complex calculations. (Many of which resembled each other and...but I digress.) Being able to move the logic off to elsewhere considerably simplified the overall design and made minor tweaks and changes a lot easier to implement. The basic idea was indeed a good fit, even if it was not a good way to first meet this approach. :-)
UPDATE
Oops, you did indeed get the join correct. And even
commented it. I missed that last night, sorry.
In reply to Re (tilly) 5: How to pass a variable to function selected from a hash
by tilly
in thread How to pass a variable to function selected from a hash
by cat2014
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |