in reply to creating empty utf8 file

If you can use a different module then:

use strict; use warnings; use UTF8BOM; my $filename = 'delme.txt'; open outFile, '>', $filename; close outFile; UTF8BOM->insert_into_file ($filename);

does the trick. See UTF8BOM.


DWIM is Perl's answer to Gödel