in reply to Re: Remove ÿþ from a string
in thread Remove ÿþ from a string
The stuff immediately after the open was to remove the carriage returns, so I could have normal unix line endings.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
"Pe", BTW is part of "P". From what I understand, in newer perls, a new keyword, "err" is weaker version of the same (doesn't allow a format statement).
Hope this is of use.
|
|---|