Here is the loop that is reading from the file, as requested. The whole script is a couple hundred lines, I can post it if you think it's necessary, but I think the problem is here. I'm using strict and warnings, just so you know.
my $HTML = $query->param(-name=>"file"); print $query->header; print $query->start_html("Class Schedule"); while (<$HTML>) { # if (/SEE SCHEDULE OF CLASSES/) { # next; # } if (/^<(?:TR).*?>(\d{5}).*?>(\d{2}).*?>(\d{3}).*?>(\d{3}).*?>(\d{2 +}).*?>(?:[&\w]).*?>(\w+(?:(?:[\s\w|&]+)?)*).*?>\s(\d).*?>(\w*?\d(?:[, +\d\*]?)*)((?:[\w\d,]?)+).*?>(\w(?:(?:[\w\d-])?)*).*?<\/TR>(<.*)?/i) { push(@classid, $1); my $rec = join("", split(/,/, $9)); my $h_fix = join("", split(/,/, $8)); $rec =~ tr/H/h/; $h_fix =~ tr/H/h/; push(@classes, $h_fix); push(@class, parse($h_fix)); push(@location, $10); my @mi2 = ($2, $3, $4, $5); push(my @misc_info, \@mi2); push(@credits, $7); my $short_name = $6; $short_name =~ s/&/ AND /; push(@classname, $short_name); if ($h_fix =~ /\*$/) { push (@starperiod, "*"); } else { push(@starperiod, ""); } if ($9) { push(@classes, $rec); push(@class, parse($rec)); push(@classid, $1); push(@location, $10); push(@misc_info, \@mi2); push(@credits, $7); push(@classname, $short_name); if ($rec =~ /\*$/) { push (@starperiod, "*"); } else { push(@starperiod, ""); } } my @erec; if ($11) { my @temprec; @erec = $11 =~ />(.*?)</g; for (my $z = 0; $z < @erec; $z++) { my $rectemp; if ($erec[$z] =~ /^&/) { } else { if ($erec[$z] =~ /\*$/) { push (@starperiod, "*"); chop($erec[$z]); $rectemp = $erec[$z]; } else { $rectemp = $erec[$z]; } push(@temprec, $rectemp); } } my $temprec_fix = $temprec[10]; $temprec_fix =~ tr/H/h/; push(@classid, $classid[-1]); push(@classes, $temprec_fix); push(@class, parse($temprec_fix)); push(@location, $temprec[14]); push(@misc_info, \@mi2); push(@credits, $credits[-1]); push(@classname, $short_name); } } } close ($HTML);
The comments at the top are my workaround, it allowed the script to simply ignore the offending line and continue.
Have fun

   -Etan

In reply to Re: Re: Re: Re: Problem with CGI script not working (regex at fault) by deryni
in thread Problem with CGI script not working (regex at fault) by deryni

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.