in reply to convert a Unicode file to Ansi, using filehandle..

Why do you think your file is converted to "ANSI"? Unless you are using an old Perl (pre 5.6.0) Perl can handle Unicode strings.

From the docs (perluniintro - Perl Unicode introduction):

The principle is that Perl tries to keep its data as eight-bit bytes for as long as possible, but as soon as Unicodeness cannot be avoided, the data is transparently upgraded to Unicode.
To make sure that your output file is encoded the same way as the input file, make sure that you do
open FILEHANDLE, '>:encoding(UTF-16)', 'my/output/file';

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James