I’ve been trying to debug this search pattern not terminated error, but can’t seem to find where in(I guess my for each loop)it is not terminated? The last line at the bottom of my code is line 160. Can anyone give me any hints on what in my code is wrong? I am trying to print out each header in the select results and each of the data in each of its rows and print it out on the CGI page.
C:\xampp\cgi-bin>perl create_report.cgi
Search pattern not terminated at create_report.cgi line 160.
foreach $rpt_sel_output(@desc_origin)
{
($rptid, $servid, $rptcat_id, $desc, $remail_add, $remail_info, $ent_usr, $ent_dte, $up_usr, $up_dte, $fav)=split(",",$rpt_sel_output);
if($rptid eq 'ReportID') #header rows
{
print"<tr>/n";
print"<th>$rptid</th>";
print"<th>$servid</th>";
print"<th>$rptcat_id</th>";
print"<th>$desc</th>";
print"<th>$remail_add</th>";
print"<th>$remail_info</th>";
print"<th>$ent_usr</th>";
print"<th>$ent_dte</th>";
print"<th>$up_usr</th>";
print"<th>$up_dte</th>";
print"<th>$fav</th>";
print"<tr/>/n";
print"</table>/n";
next;
}
print"<tr>/n";# data from select that was outputed
print"<td>$rptid</td>";
print"<td align 'right'> $servid</td>/n";
print"<td align 'right'> $rptcat_id</td>/n";
print"<td align 'right'> $desc</td>/n";
print"<td align 'right'> $remail_add</td>/n";
print"<td align 'right'> $remail_info</td>/n";
print"<td align 'right'> $ent_usr</td>/n";
print"<td align 'right'> $ent_dte</td>/n";
print"<td align 'right'> $up_usr</td>/n";
print"<td align 'right'> $up_dte</td>/n";
print"<td align 'right'> $fav</td>/n";
print"<tr/>/n";
}
}
print"</table>/n";
print"<<FOOTER/n";
</body>
print</html>FOOTER;
You’re missing double quotes around those print statements at the bottom. They should look like this:
If you aren’t already, you should use an editor with a syntax highlighter. They point out issues like this clearly.
The reason the error was talking about a search pattern was because it was seeing a
/character, which begins defining a regular expression (or search pattern).