my $fileDest = "hostsfile_modified.txt"; die "Problème de création du fichier $fileDest" unless open(my $fd, '>:encoding(UTF-16)', $fileDest); my $line = ""; #I build my $line... print $fd $line."\n"; close $fd;