I'm trying to write a simple fetch program to get some files from a sftp server.
Here is what I got.
This should print out a list of the files on the sftp serverm, however it only prints out these hash refrences.
This is what I found a cpan.org
However, I not really sure what the above means. As I'm still learning here.
So, how would I turn these hash refrences into the actual file names?
Thanks for any help.
Here is what I got.
Code:
$args{debug} = "true"; $args{user} = $ftp_user; $args{password} = $ftp_pass;
$sftp = Net::SFTP->new($ftp_site, %args) or die "Cannot connect to $ftp_site: $@";
@files = $sftp->ls($remote);
foreach $f(@files) {
print $f;
}
This should print out a list of the files on the sftp serverm, however it only prints out these hash refrences.
This is what I found a cpan.org
Code:
$sftp->ls($remote [, $subref ])
Fetches a directory listing of $remote.
If $subref is specified, for each entry in the directory, $subref will be called and given a reference to a hash with three keys: filename, the name of the entry in the directory listing; longname, an entry in a "long" listing like ls -l; and a, a Net::SFTP::Attributes object, which contains the file attributes of the entry (atime, mtime, permissions, etc.).
If $subref is not specified, returns a list of directory entries, each of which is a reference to a hash as described in the previous paragraph.
However, I not really sure what the above means. As I'm still learning here.
So, how would I turn these hash refrences into the actual file names?
Thanks for any help.