in reply to Re^4: Running complex sed from perl
in thread Running complex sed from perl

Your lines probably end with newlines (carriage returns), so your end quote ends up at the beginning of the next line. To avoid that, chomp the line, add your quotes, then print it with a newline:

chomp $line; $line = qq|"$line"|; print "$line\n";

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.