Well, I certainly am glad I just picked up the new Camel book. I had been having quite a time trying to find patterns common to multiple strings. I had sample input of two strings "ABCD". For each 1,2,3 and 4 character substring there should have been 2 matches, right? Not so. My original code looked liked this (relevant part only):
$all{$str} += $packets[$_] =~ /$str/g;
When I ran it against the sample input, I got weird output. For example, two character substring matches: Any combination would produce the weird 2,0,2,0, etc pattern of matching.
Following much frenzied thumbing through the Camel, I ran across almost an offhand mention to pos. I added the line
pos $_ = 0; after the previous line, and now the counts work perfectly.
I feel good that I managed to find this one by reading the FM, but also feel that I should mention it since it never came up in any of the (wonderful!) responses I've received to the pattern matching problem and its revisit.

In reply to Shot myself in the foot with a pos by Guildenstern

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.