First of all, we need to see the data that should match more than once. For example

This is my abcdef page. That contains many instances of abcdef.  So far I can count 2 instances of abcdef... oops that makes 3.

Without knowing what the page looks like and how many hits it should get, it's hard to gauge whether your output of 1 is incorrect. Also, checking the contents of the scalar you are pushing could lead to some interesting discoveries. This may not be your exact code, but if you haven't checked its contents, I would highly reccomend it.

Also, using scalar to pring out the size of the array may be unneccesary in your perl version. In 5.8, I don't know how far this dates back, you can print the size of the array by simply issuing print @files;


In reply to Re: Hits on a reg expression by Grygonos
in thread Hits on a reg expression by Anonymous Monk

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.