As I said
below,
$/==""; is a meaningless statement - a logical test where you do not use the return value. What is wrong with the solution I provided? As far as I can tell, it works on both your file formats. Using
$/ in this context would require you to know the format of the file ahead of time - you would have to read the file twice.