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:
submit_thingamabob($handle,$not_today,$thingie,"Foo!",234); submit_thingamabob($handle,$not_today,$thingie,"Frob!",23); submit_thingamabob($handle,$not_today,$thingie,"Forb!",54); submit_thingamabob($handle,$not_today,$thingie,"ooF!",11); submit_thingamabob($handle,$not_today,$thingie,"broF!",fakenum); submit_thingamabob($handle,$not_today,$thingie,"Frap!",458);
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.
Thoughts?
|
---|