Remove Text between two Strings

That scalar string has several embedded \n, as if it is a here document. You can remove everything from the first ‘*’ to the end of the string with:

$stval =~ s/[*\n]+.+//g;    # this removes all * Characters

Leave a Comment