in reply to validating a quoted string
Count the double-quotes?
say $in =~ (/"/g % 2) ? 'invalid' : 'valid'; [download]
Update: slower fingers than choroba but nice to know others thought of the same simple approach.