note
Eliya
<c>
$str =~ s/[+-](\d+)(??{".{$1}"})//g;
</c>
<p> (Unfortunately, the straightforward attempt <c>$str =~ s/[+-](\d+).{\1}//g;</c> doesn't work.) </p>
<p> See [http://perldoc.perl.org/perlre.html#%28??{-code-}%29|(??{ code })]. </p>
<p> <b>Upd:</b> changed <c>(??{"\\w{$1}"})</c> to <c>(??{".{$1}"})</c>, just in case you need to remove any character, not just alphanumeric. </p>
973113
973113