if( /"((?:[^"]+|"")*)("?)(?!")/ ) { # ^ ^^ die "Unclosed quote ($1)..." if ! $2;