my $ls; @{$ls} = $ftp->dir(); if (!@{$ls}) { print "Unable to list files in ftp://$host/$dir\n"; logError ("Unable to list files in ftp://$host/$dir"); return undef; } print Dumper($ls); #### $VAR1 = [ '-rw------- 1 ftp ftp 4037 Oct 04 16:15 1.jpg', '-rw------- 1 ftp ftp 10209 Oct 04 16:15 2.png', '-rw------- 1 ftp ftp 1314 Oct 03 10:59 3.gif' ]; #### my $ls; $ls = $sftp->ls() or die "unable to retrieve directory: ".$sftp->error; if (!$ls) { print "Unable to list files in sftp://$host/$dir\n"; logError ("Unable to list files in sftp://$host/$dir"); return undef; } $ls = $_->{longname} for @$ls; print Dumper($ls); #### $VAR1 = [ 'drwx--S--- 2 pgpftp pgpftp 4096 Oct 5 11:06 .' ]; #### $VAR1 = [ 'drwx--S--- 2 pgpftp pgpftp 4096 Oct 5 11:06 tst1.jpg', 'drwx--S--- 2 pgpftp pgpftp 4096 Oct 5 11:06 tst2.jpg', 'drwx--S--- 2 pgpftp pgpftp 4096 Oct 5 11:06 tst3.jpg' ];