use strict; use Net::FTP; my $remote_host = "*****************"; my $remote_user = "*******"; my $remote_password = "*******"; my $remote_dir = "/tmp"; my $ftp = Net::FTP->new($remote_host) or die "error initiating ftp: $!\n"; $ftp->login($remote_user,$remote_password) or die "couldn't login: $!\n"; # force binary transmission of files, generally a good idea $ftp->binary(); my @files = $ftp->ls($remote_dir); print join "\n",@files; print "\n","="x80,"\n"; # now change current working directory and do ls there $ftp->cwd($remote_dir); my @files = $ftp->ls(); print join "\n",@files;