If the file is large and the line-ending is truly unpredictable, you can read (say) the first 1,000 bytes of the file and then search for the various separators – starting of course with the two-byte ones first. Use this to set the Perl record-separator variable. (And if you don't find any of the expected sequences, die.) Remember to seek back to the start of the file before proceeding.