in reply to how do I check encoding before opening FILEHANDLE
(untested code)eval { open(XMLFILE, '<:encoding(utf16)', $logfile) or die $!; }; if ($@) { # whatever will match your error message, # just skip the file. next if $@ =~ /^:BOM error/; # unexpected message, bail out. die $@; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how do I check encoding before opening FILEHANDLE
by dbrock (Sexton) on Feb 17, 2005 at 21:10 UTC |