in reply to regex match only outside the double quotes

hi, Try out this one it will work fine. test.txt -- test the line,8,description; (Need to remove the line) test the line,8,description="testing -- done"; (No need) test the line,8,description="testing -- done"; -- commented line (need to remove the words after the -- symbol)
open(FILE,"test.txt") or die $!; while($line=<FILE>){ $line=~s/-- .*//g; print "$line\n"; }