in reply to joining multi lines using xargs

That's going to mangle your lines anyway. You could use:

perl -pe'chomp; END { print "\n" }' file

Update: Forgot about "inside a Perl script". Well, let's avoid launching a new Perl, then.

open(my $fh_in, '<', $qfn_in) or die("Can't open \"$qfn_in\": $!\n"); open(my $fh_out, '>', $qfn_out) or die("Can't create \"$qfn_out\": $!\n"); while (<$fh_in>) { chomp; print $fh_out $_; } print $fh_out "\n";

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.