As requested, this is just a starting place based upon the information you've provided and testing is limited to exactly that shown in the output. You'll probably want to tweak the regex to better match your data.

In terms of performance, I tested it against 10 years worth of monthly files with 100 comments per file, which I think far exceeds your requirements, and it takes all of 6/100ths of a second. That's probably how long it would take to make a connection to a database.

#! perl -slw use strict; use Time::HiRes qw[ time ]; sub slurp { local( $/, @ARGV ) = ( -s( $_[0] ), $_[0] ); <>; } my $start = time; my $user = $ARGV[0] or die 'No user supplied'; my @matches; my $files = 0; while( glob 'hist/*.htm' ) { $files++; my $file = slurp $_; push @matches, $_ if $file =~ m[ <b>Comment\s+\d+</b><br>\n \Q$user\E ]mx; } printf "Searched $files files in %g seconds\n", time() - $start; die "No match found for user $user" unless @matches; print "User $user found in files:\n", join "\n", @matches; __END__ P:\test>522029 Buk Searched 133 files in 0.0694289 seconds No match found for user Buk at P:\test\522029.pl line 26, <> line 133. P:\test>522029 Doug Searched 133 files in 0.069006 seconds User Doug found in files: hist/h0511.htm hist/h0601.htm P:\test>522029 "J H" Searched 133 files in 0.0696189 seconds User J H found in files: hist/h0511.htm hist/h0601.htm

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Search function for guestbook history? by BrowserUk
in thread Search function for guestbook history? by JCHallgren

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.