use Syntax::Construct qr{ /r }; $string =~ s:/ \* (.*?) \*/ : $1 =~ s/[^\n]//gr :gsex;