in reply to Creating a table from text delimited by newlines
Note that I replaced the regex with a call to length. I think this is a clearer way to check whether the line contained any text (after chomping, of course).$line = ''; while (<FH>) { chomp; if (length) { $line .= "$_ "; } else { print <<"EOHTML"; <TR> <TD>Checkbox</TD> <TD>$line</TD> </TR> <TR bgcolor=#000066><TD WIDTH=298> </TD><TD WIDTH=298> </TD> +</TR> EOHTML $line = ''; } } if (length $line) { print <<"EOHTML"; <TR> <TD>Checkbox</TD> <TD>$line</TD> </TR> EOHTML }
Your question would be clearer with sample input and output...
|
|---|