http://www.perlmonks.org?node_id=1197989


in reply to Re^2: Writing a .txt file for import in Excel with UTF-8 BOM
in thread Writing a .txt file for import in Excel with UTF-8 BOM

If you want to open the file in Excel with a double mouse click rather than using the text import wizard, File::BOM will work or just add another print line to your script.

#!perl use strict; use utf8; #use File::BOM(); #open my $fh, '>:utf8 :via(File::BOM)','output_with_bom.csv' # or die "$!"; open my $fh, '>:utf8','output_with_bom.csv' or die "$!"; print $fh chr(0xFEFF); # U+FEFF is EF BB BF as utf-8 print $fh $_ for <DATA>; close $fh; __DATA__ a,1 b,2 ,3 ,4
poj