in reply to Can't create DOS line endings under Unix in heredocs

Because perl often is fed dos files even on unix, it tries to come up with the appropriate line endings for the OS it is running under. Save it to a variable and s///:
$x = <<MULTI; foo bar MULTI $x =~ s/\n/\r\n/g; print OUT $x;