in reply to Net::FTP corrupting files or timing problem

You're not checking if any of the calls to $ftp succeed. Networked actions do fail, and in my experience, FTP fails a lot.

When the Net::FTP docs's example is

$ftp = Net::FTP->new("some.host.name", Debug => 0) or die "Cannot connect to some.host.name: $@"; $ftp->login("anonymous",’-anonymous@’) or die "Cannot login ", $ftp->message; $ftp->cwd("/pub") or die "Cannot change working directory ", $ftp->message; $ftp->get("that.file") or die "get failed ", $ftp->message; $ftp->quit;

don't think they're just kidding.