use strict; use warnings; use Net::FTP::Recursive; use File::Tee qw(tee); tee(*STDOUT, '>', 'capture.txt'); my $ftp = Net::FTP::Recursive->new("ftp.mozilla.org", Debug => 0); $ftp->login("anonymous",'me@here.there'); $ftp->rls( Filehandle => *STDOUT); $ftp->quit;