.... system("ftp -n -s:ftpcred.txt $host > out.txt"); .... # file:ftpcred.txt #================== user root xxxx ls quit