in reply to Search a perl reference and replace characters

The following seems to be what you are after:

use strict; use warnings; my @lines = <DATA>; chomp @lines; # Strip line end characters print '<p>', join ("</p>\n<p>", @lines), "</p>\n"; __DATA__ Hello, my name is barry I am 20 I am webmaster of lsrfm.com its a student radio station

Prints:

<p>Hello,</p> <p>my name is barry</p> <p>I am 20</p> <p>I am webmaster of lsrfm.com</p> <p>its a student radio station</p>

Note that line ends are put back into the generated HTML so it is easier to read. They make no difference to the rendering.


DWIM is Perl's answer to Gödel