use Regexp::Common; $string =~ s/$RE{comment}{C}//g;