Help for this page

Select Code to Download


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