in reply to [Solved]Newbie - convert carriage return in a variable
I have tried with HTML::Parser
I wonder why, since there is no HTML to parse. Instead see this solution using s///:
use strict; use warnings; use Test::More tests => 1; my $have = 'foo bar'; my $want = 'foo<br />bar'; $have =~ s/\n/<br \/>/; is $have, $want;
Hopefully you will see here that I have included nothing which is superfluous to the task at hand.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Newbie - convert carriage return in a variable
by Balawoo (Novice) on Feb 17, 2019 at 17:50 UTC | |
by poj (Abbot) on Feb 17, 2019 at 18:09 UTC | |
by Balawoo (Novice) on Feb 17, 2019 at 19:06 UTC |