in reply to Re^2: feeding stdin of executed command and store stdout in $var
in thread feeding stdin of executed command and store stdout in $var

Thank you for clarifying what you intend to do.

Have you tried using Net::FTP instead of lftp? In what way was it unsuitable for your needs?