ambuli
asked on
Perl : How to remove a substring from a string
Hi Experts,
I have to print the portion of a string by removing anything before the word teststring in the following string.
this is: a long line teststring: this portion is needed
I want to print the new string as: this portion is needed.
Thank you
I have to print the portion of a string by removing anything before the word teststring in the following string.
this is: a long line teststring: this portion is needed
I want to print the new string as: this portion is needed.
Thank you
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
$value =~ s/^.*?teststring//;
as there is no reason to capture the string being removed.