my @file; { my $lh; open($lh, "<:utf8:crlf", $LogFn) || do { Pe "\nlogfile <%s> not found", $LogFn; help; }; @file = grep { s/([^\r]+)$/$1/; m{^\s*$} ? undef : $_; } <$lh>; close $lh; } $file[0] =~ s/^\N{U+FEFF}//; # UTF-8 BOM