Re: nl2br
| From: | Dan Lowe | Date: | Mon, 02 Apr 2001 22:35:44 +0000 |
| Subject: | Re: nl2br | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46694@lists.php.net to get a copy of this message | ||
Previously, Boget, Chris said:
> > In PHP there is an instruction : nl2br .
> > Does anybody know if there is something similar in Perl???
>
> I think this syntax is correct... it's been a while...
> $string =~ /\\n/\<br\>/g
That would match a backslash followed by the letter 'n'... also the leading
's' operator is missing.
$string =~ s/\n/<br>/g;
Quoting the < and > is not necessary, although it doesn't make a difference
in this case. I didn't quote them because there wasn't a need to.
-dan
--
Dan Lowe <dan@tangledhelix.com> http://tangledhelix.com/
Politics is the art of looking for trouble, finding it whether it exists or
not, and applying the wrong remedy. -Ernest Benn