in reply to mac win and unix EOL chars, $/ question

if ($_ =~ /[^\r]/ && $_ =~ /\n/) { $os = "unix"; $/ = "\n"; }
the /[^\r]/ will match any string which has a non \r character so the string "\r\n" will match because the \n is not a \r. what you want is:

$_ !~ /\r/ (or, to save a few keystrokes: !/\r/)

the same thing goes for the /[^\n]/ on the next line