$str =~ s/[+-](\d+)(??{".{$1}"})//g;
(Unfortunately, the straightforward attempt $str =~ s/[+-](\d+).{\1}//g; doesn't work.)
See (??{ code }).
Upd: changed (??{"\\w{$1}"}) to (??{".{$1}"}), just in case you need to remove any character, not just alphanumeric.
In reply to Re: Find Number in String then Ignore Characters proceeding
by Eliya
in thread Find Number in String then Ignore Characters proceeding
by BenPen95
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |