Here’s another way:
If you don’t need the original string anymore, just give an empty string as the REPLACEMENT argument to substr:
1:26 >perl -E " $string = qq[ATATTTATATTAT]; say $string; $removed = +substr($string, 0, 3, q[]); say $removed; say $string; " ATATTTATATTAT ATA TTTATATTAT 1:30 >
Hope that helps,
Athanasius <°(((>< contra mundum
In reply to Re: Extract string after removing the substring
by Athanasius
in thread Extract string after removing the substring
by viktor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |