in reply to how do I check encoding before opening FILEHANDLE

One way to handle this, if the error is consistant, is to use an eval to trap it.
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 $@; }
(untested code)

UPDATE: cleaned up the code a little for formatting reasons.

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
    I have attempted to try this approach so far no luck ... Thank you for your time... DBrock...