in reply to using $ftp->mdtm($file)

L~R's approach is correct: Feed $ftp->mdtm() right to a scalar.

Also, don't forget to log off the server. Killing a process before sending 'QUIT^M' to the server is not nice.