in reply to Text file to UTF-8 encoding

In what encoding is it now? Suppose it's in encoding $x, try this:
use Encode qw(from_to); my $str = do { local(*ARGV); @ARGV=$File; <> }; open my $out, '>', 'X:\TestData.txt.UTF-8' or die $!; print $out from_to($str, $x, 'UTF-8'); close $out or die $!;

Of course you can also just use IO layers.

open my $in, "<:encoding($x)", $filename or die $!; open my $out, ">:encoding(UTF-8)", "$filename.utf8" or die $!; select $out; pirnt while (<$in>); close $in or die $! close $out or die $!;

Your version can't work because Encode::encode doesn't modify its arguments, and you're ignoring the return value of the map.

(Update: fixed typo in from_to, ambrus++)