in reply to utf-8 problems

You should pass {mysql_enable_utf8 => 1} to the constructor, and decode the output before writing to utftest2.txt: open TST, '>:encoding(UTF-8)', 'utftest2.txt';

See also: A UTF8 round trip with MySQL, which explains all the details and contains a worked example.