my $file_segment_name = "TestFile1.svd"; open( I, "<:encoding(UTF-16LE)", $file_segment_name ) or die "$file_segment_name: $!"; local $/; $_=; # slurp full file content in one read s/\x{feff}//; # remove BOM @lines = split /\r\n/; print "line #$_ : $lines[$_] (EOL)\n" for ( 0 .. $#lines );