|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Re^3: memory issuesby Anonymous Monk |
| on Jan 28, 2013 at 17:01 UTC ( #1015738=note: print w/ replies, xml ) | Need Help?? |
|
Just a small hint to reduce the verboseness of your code:
can be rewritten using a hash slice like this:
Otherwise, your code benefits from a temporary variable or two. Here I repurpose $pvt (not sure if the variable name makes sense after that):
(This only works because there already exists a hash reference at $ipairs{$fk}{$pair}. It would not work if you tried to say $pvt = {}, but %$pvt = () would. It's all reference magic and not really easy to explain unless you first understand pointers.) (Of course, the hash slice can be rewritten using a temporary variable, too. It's always a good idea to use temporary variables if it makes your code easier to understand. Triply a good idea if it reduces repetition.)
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||