I'm a Perl newbie/novice who managed, with GREATLY appreciated help from this forum about a year ago (THANKS!), managed to rework/code a script for a site guestbook into exactly what I wanted. That was: a simple chat room for my town.
However, now I'd like to add a user search function to my site. The web pages I'd want to scan are all in one folder/sub-dir (/Hist) and are named in style of "h0512.html" where it's YYMM after "h". There is a special comment that delimits the start and end of actual user data within the page, and each comment/post is delimited by "hr" or "HR" tags. There can be multiple lines in each post, using "BR" tag but the comment is always separated from signature by a "/B" tag.
To better show what I have as data, here is a condensed page with some sample data:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD><META http-equiv="Content-Type" CONTENT="text/html; charse +t=iso-8859-1"> <TITLE>Last Post </TITLE></HEAD> <BODY> <!--begin--> <HR> <b>Comment 1</b><br> Doug &lt;<a href="mailto:hun@tele.com">hun@tele.com</a>&gt;<br> USA - Thu 01/05/2006 - 22:05:51 <hr> <b>Comment 2</b><br> J H<br> Clearwater, FL USA - Wed 01/04/2006 - 02:05:12 <hr> <!--end --> </BODY></HTML>
What I'd like to do is first provide a way to find all posts by a certain user.
Creating the input form is not a problem for me, but how to do the search is. I know that I'll have to have a loop to read each month's history file and then a loop to scan thru entries, so how to do that is my first task. Then locating the signature line while keeping the post data saved so I can output it to a on-the-fly results web page is another issue.
So...are there any pre-existing code blocks or routines that I can adapt to this? I'd just like some good pointers on where to look...not expecting anyone to do the code!

In reply to 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.