sanPerl has asked for the wisdom of the Perl Monks concerning the following question:
I am Not able to understand the error Not a HASH reference at xx.pl line 7.. Also I am touching Perl code after two years and it seems I have lost the touch (Feels great to work on it again :-)). Can someone help me please ?use strict; use lib '/myperllib'; use Net::SFTP::Foreign; my $host="root\@10.111.11.11"; my $password="password"; my $sftp = Net::SFTP::Foreign->new($host, fs_encoding => 'latin1'); my @ls = map { $_->{filename} } $sftp->ls('/root/mydirs'); foreach my $myfile (@ls) { print "File: $myfile\n"; }
my $ls = $sftp->ls('/root/mydirs', no_wanted => qr/^\./ ); my %size = map { $_->{filename} => $_->{a}->size } @$ls; foreach my $filename (sort keys %size) { print "$filename : $size{$filename}\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Not getting List of files from Net::SFTP::Foreign
by syphilis (Archbishop) on Sep 03, 2013 at 04:19 UTC | |
|
Re: Not getting List of files from Net::SFTP::Foreign
by kcott (Archbishop) on Sep 03, 2013 at 05:23 UTC |