Jamie Risk wrote:
> A few days back I decided that all the html formating I've been doing
> with Perl had probably been done before; so now I'm reading 'perldoc
> CGI'. 
> 
> Anyway, in my (newsgroup simplified) old code I had the following;   
>     print " <tbody>\n"; while (<$tabbed_text_fh>) {
>         tabbed_text_2_html_table_row_normal($_);
>     }
>     print " </tbody>\n";
> 
> Which I've successfully replaced with;
> 
>     print " <tbody>\n";
>     while (<$tabbed_text_fh>) {
>         s/([^\n\r]+)[ \t\n\r]+$/$1/;
>         print Tr(td([split(/\t/)]));
>     }
>     print " </tbody>\n";
> 
> 
> My question is then:
>  * is there a way to embedd the 'while' loop within the CGI
> function/method call to 'tbody()'?

use CGI qw/:standard tbody/;

print tbody(
   Tr(
      [map { s/([^\n\r]+)[ \t\n\r]+$/$1/; td([split /\t/]) }
<$tabbed_text_fh>]
   )
);

I'm not sure what your regex is trying to do. Why not just s/\s+$//

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to