I'm trying to search a user-given string in an html file that is enclosed in TR tags on multiple lines. Every entry that is searchable has its own set of TR tags. So here's a simplified sample file:
<TR>
<p> FOO BAR </p>
<a href=www.yahoo.com>yahoo</a> </TR>
This format follows throughout the file, and only the line that says FOO BAR is searchable, but I want to return that line and the line after (and hypothetically, the line after that, and after that and so on...) when a search is confirmed. Here's my problem: I can find the line with the "hit" just fine, but for the life of me, I can't make perl notice the </TR> tag. here's a sample of the code I am trying to make work:
my $trString = "</TR>";
while ( <DATAFILE> )
{
	chomp;
	if ( /$content/ )
	{
		$searchString .= $_;
		until ( /$trString/ )
		{
			chomp;
			$searchString .= $_;
		}
		print "<TR>$searchString";
	}
}
I have tried numerous things, messing with flags, etc, and I couldn't get it to work.. can someone help? Worth noting: I'm a newbie at perl and have programmed in java/c/basic my entire life, so please be patient if this looks like garbage to you. Thanks!

In reply to File/String search... by Sharky_The_Dog

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.