Help for this page

Select Code to Download


  1. or download this
    my $text = "abcDE\x08\x08xyz\x08Z"; # \x08 is the backspace character
    
    ...
      substr($text, pos($text)-2, 2, '');
    }
    print $text, "\n"; # emits: abcxyZ
    
  2. or download this
    while ($text =~ m/(\x08+)/g) {
      substr($text, $pos-2*length($1), 2*length($1), '');
    }
    print $text, "\n";