my $newline; for my $test ("\015\012","\015","\012") { # Default to unix. $newline = $test; last if /$test/; }