John W. Krahn wrote:
q() is another way of saying ''. All the quote operators can be found in the perlop.pod document under "Quote and Quote-like Operators" section.
If you want your version to work correctly you are going to have to enclose the second test and replacement strings in double quotes:
$line =~ s/("[^"]+"|\w+)/ $1 eq $oldList[$i] ? $newList[$i] : $1 eq qq("$oldList[$i]") ? qq("$newList[$i]") : $1 /eg;
John