in reply to Replacing left angle bracket with HTML entity when between two backtick characters
Something like this might work:
my $parts = [ split /[^\\]`|^`/, $string ]; my $count = 0; foreach my $part (@$parts) { $count++; next if ($count %2); # only substitute on odd number array items $part =~ s/</</g; } my $new_string = join '`', @$parts;
Still seems lame, but I guess it works. Any other suggestions?
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replacing left angle bracket with HTML entity when between two backtick characters
by choroba (Cardinal) on Sep 20, 2018 at 09:32 UTC | |
|
Re^2: Replacing left angle bracket with HTML entity when between two backtick characters
by nysus (Parson) on Sep 20, 2018 at 03:19 UTC |