But even though $1 when printed includes the parenthesis, the substitution statement does not remove them. Am I missing something trivial (probably)? Many thanks.my $s = "bla bla (parenthesis) somestring"; if ($s =~ /.*(\(parenthesis\))\s*somestring/) { print "matched $1\n"; #this prints "(parenthesis)" $s =~ s/$1//; # $s now looks "bla bla () somestring" rather than the desired + "bla bla somestring" }
In reply to Remove text within parenthesis by firmament
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |