|There's more than one way to do things|
Simplifying repeated parameter listsby Voronich (Hermit)
|on Sep 19, 2012 at 19:36 UTC||Need Help??|
Voronich has asked for the
wisdom of the Perl Monks concerning the following question:
This is driving me BANANAS (short a trip as that may be.)
Take the following code sample:
Now multiply that by about 20. So I've got dozens of calls with the same parameter list (at the value level) except for the final couple. What's the right way to simplify this? Pulling all of the final pairs into their own hashes just for the purpose of iterating across them seems silly (especially since I'd have to explicity specify them all anyway. Why add semantic complexity?)
My intuition (such as it is) intuits that I should be able to distill it down with an inner subroutine reference somehow.
I'm not really looking to eliminate the "nubmer of lines", since that's necessary complexity (no matter where the can is kicked.) But the repetition of the first three parameters is driving me batty.