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?


In reply to Simplifying repeated parameter lists by Voronich

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.