my $nativeSeparator = "\n"; if ($^O =~ /MSWin32|dos|os2|cygwin/) { # not sure what to do about cygwin here. $nativeSeparator = "\x0d\x0a" } elsif ($^O eq 'MacOS') { $nativeSeparator = "\x0d" } elsif ($^O eq 'VMS') { # it depends on file type... what to do? } elsif (ord('A') eq 193) { # what to do for EBCDIC? "\n" may be OK... }