in reply to Script output sometimes gets jumbled

It might be interesting to see the log files at the time it screws up. But without access to your actual ftptelnet server, this is pretty hard to test.

I would at least try fixing the newlines so you're not sending CRLF to the cmd() function - it expects only the \n. And make sure there are no empty lines. i.e.:

while(<>) { chomp; next if !length; @lines = $t->cmd("bin/dsjob -jobinfo $project $_\n");
Maybe add an explicit timeout option to the cmd() function as well.