The output record separator may help you do what you want:
This may be a problem if you are not writing to OUTFILE only while $\ is changed. If you can limit the change to a defined scope (ie: localize) that would probably be better:$\ = $endofline; print OUTFILE $processed_string; # Appends the wanted end of line corr +ectly
{ local $\ = $endofline; my $old_handle = select OUTFILE; # Write to OUTFILE only while (<>) { process($_); print $_; # write to selected handle (OUTFILE) and append $\ } select $old_handle; } # $\ has its old value again
In reply to Re: Copying an ascii text file, replicating end of line terminator (windows or unix)
by Eily
in thread Copying an ascii text file, replicating end of line terminator (windows or unix)
by luckycat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |