in reply to using a variable as a filehandle

You may find this node on a Net::FTPServer MySql port very interesting. Touches on what you want to do and is a very CUFP.