Darn. I was proud of the @{[]} trick I hacked together for this problem, too bad it scored so poorly. Ah well, thanks for the benchmarks extremely, and congrats on the promotion. {g}

This kind of reminds me of a show on A&E I caught a few minutes of the other day. It had Jeremy Irons in it and he was trying to rebuild an old clock, either from an old schematic or model, I'm not sure which. At any rate, it was one of the first shipboard clocks, one to counteract the effect the swaying deck had on the pendulum. At one point, he becomes irate, saying "...it's a terrible mess, layer and layer of complexity, one piece correcting for the last. The man absolutely refused to admit he was wrong and come up with other concepts." Or something to that effect. =)

I just thought that fit nicely in with this. Presented with a problem and current behavior (m//g returns a list of matched values in list context) I used the ol' hammer-and-nail routine. It seemed to work well enough and made absolute sense to me. But some other folks went back to the root of the problem and came up with completely different solutions that worked from an oblique angle. Look at mirod's solution, for example, something I would have never even thought of. Amazing.

The nature of Perl, I suppose...

'kaboo


In reply to (TMTOWTDI) Re (2): Getting the number of times a regexp matches by mwp
in thread Getting the number of times a regexp matches by MeowChow

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.