$_ = q(aaa; ; bbb ; "ccc ; ddd ;" ee;e ";" fff ;); s/(".+;.+"|;)/$1 ne ';' ? $1 : '&&'/ge;