for (@data) { chomp; $_ =~ s| \\- # Start of a commented section [^(-/)]+ # Anything that isn't the end of a comment -/ # End of commented section ||gx; }