in reply to Re: Re: Printing From a File Handle
in thread Printing From a File Handle

Still more ways to do it:

# list processing print map "$_<br />", <AP_MENU>; # more abuse of special variables { local $, = "<br />"; print <AP_MENU>, ''; }

If you are reading in any old file for display in an HTML page, you will want to do at least minimal escaping of special characters, too:

while ( <AP_MENU> ) { # protect against most egregious HTML violations s/&/&amp;/g; s/</&lt;/g; s/>/&gt;/g; # remove trailing whitespace so the <br /> is on # the same line as main text s/\s+$//; print "$_<br />\n"; }

Replies are listed 'Best First'.
Re: Re^3: Printing From a File Handle
by bkiahg (Pilgrim) on Apr 29, 2004 at 15:04 UTC
    Good call tkil I forgot about escaping html characters!