- or download this
for (my $pos = length($text); $pos ; --$pos)
{
...
substr($text, $pos-1, 1) = "$opening_tag$char$closing_tag";
}
}
- or download this
$text =~ s/(\S)/(int rand 2) ? "$opening_tag$1$closing_tag" : $1/ge;
- or download this
my $tag_is_open = 0;
for (my $pos = length($text); $pos > 0; )
...
else { --$pos }
}
$text .= $closing_tag if $tag_is_open;