Hi, I haven't tested this but it should work. The only problem is that you don't need to print an end of table (</table>) before the first heading, and you need to print one after the last table (which this script doesn't print) You need to check if a certain header, is the first, and don't print a </table> for it, and print a simple </table> at the end of the script (to be printed after the last table).
foreach $rec (@ODB){ chomp($rec); if($rec =~ /^#.+/) { $rec =~ s/^#//; print <<eof; </table> <h1>$rec</h1> <table> eof #You've forgotten to put the eof above this line #and you need to print the start of the table here if ($rec =~ /=/) { #The code is totally wrong here #You don't need to add eof (I've deleted it) #And you don't need to print a header for each line (I've deleted it) ($first,$last)=split(/\=/,$rec); print <<eof; <tr> <td> <font size="2"> <a href="edit_record.cgi?&first=$first&last=$last&configfile=$database">Edit</a > - <a href="edit.cgi?action=delete&first=$first&last=$last&configfile=$database"> Delete</a> </font> </td> <td> <font size="2">$first</font> </td> <td> <font size="2">$last</font> </td> <td></td> </tr> eof } #don't put here an eof } Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] ----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Octavian Rasnita" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, January 14, 2003 6:55 PM Subject: Re: Text file format output Hello Rasnita, IAm I doing the right thing, here, some how my table appears after the text. You help in this regards is greatly appreciated. Suresh. foreach $rec (@ODB){ chomp($rec); if($rec =~ /^#.+/) { $rec =~ s/^#//; print <<eof; <h1>$rec</h1> if ($rec =~ /=/) { ($first,$last)=split(/\=/,$rec); print "<h1>$rec</h1><tr><td><font size='2'><a href='edit_record.cgi?&first=$first&last=$last&configfile=$database'>Edit</a > - <a href='edit.cgi?action=delete&first=$first&last=$last&configfile=$database'>D elete</a></font></td><td><font size='2'>$first</font></td><td><font size='2'>$last</font></td><td></td></tr>\n"; } eof } ----- Original Message ----- From: "Octavian Rasnita" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, January 13, 2003 11:36 PM Subject: Re: Text file format output > Use: > > if($rec =~ /^#.+/) { > $rec =~ s/^#//; > print <<eof; > <h1>$rec</h1> > eof > } > > But you should close the prior table when printing this heading, and start > another one after it. > > Teddy, > Teddy's Center: http://teddy.fcc.ro/ > Email: [EMAIL PROTECTED] > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, January 13, 2003 10:34 PM > Subject: Text file format output > > > Hello All, > The code below shows lines in a text file with all the lines in this format > "parameter=value", now I want to read lines starting with # signs and put > them as headings in the html output, any idea , how I can achieve this. > Thanks for your help. > > if ($rec =~ /=/) > { > ($first,$last)=split(/\=/,$rec); > print "<tr><td><font size='2'><a > href='edit_record.cgi?&first=$first&last=$last&configfile=$database'>Edit</a > > - <a > href='edit.cgi?action=delete&first=$first&last=$last&configfile=$database'>D > elete</a></font></td><td><font size='2'>$first</font></td><td><font > size='2'>$last</font></td><td></td></tr>\n"; > } > > Suresh. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]