in reply to Replacing line returns with br

Try
$text =~ s/\r?\n/<BR>/g;
\\r is trying to replace a slash followed by an r, not a carriage return or whatever... and if it is a unix file it won't have a \r even... not sure but mac files are weird, too...

                - Ant
                - Some of my best work - (1 2 3)

Replies are listed 'Best First'.
Re: Re: Replacing line returns with br
by Juerd (Abbot) on Jan 08, 2002 at 00:08 UTC
    mac   \015
    *nix  \012
    dos   \015\012
    
    So, my way of doing this is s/\015?\012|\015/<br>\n/g.

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$