Further more the input listed is in:
my $text = "above"
Huh?
Do you wish to convert 'newlines', or 'carriage returns'? My guess is probably newlines. If that's the case, you may be looking for something like this:
$input =~ s{\n}{</p&rt;<p&tk;}gOr maybe you really do mean carriage returns, in which case it would be:
$input =~ s{\r}{</p&rt;<p&tk;}gYour entities look funny to me though, but that's a different issue.
Regular expressions, including 'substitutions' are covered in perlre, perlrequick, and perlretut. Those documents will go a long way toward clearing the haze regarding string manipulation and pattern matching in Perl. They're well worth the time they take to read.
Dave
In reply to Re: Search a perl reference and replace characters
by davido
in thread Search a perl reference and replace characters
by barrycarlyon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |