in reply to Using Net::SFTP

print $sftp->ls('.'), $/;

I don't know anything about Net::SFTP, but the doc sez:

$sftp->ls($remote [, $subref ])

Fetches a directory listing of $remote.

If $subref is specified,
[but you're not specifying a $subref] ... .

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.
[emphases added]
So try something like (untested)
    use Data::Dump qw(dd);
    ...
    my @ra = $sftp->ls('.');
    dd \@ra;
to see what you're really getting back.

Update: See also Data::Dump.


Give a man a fish:  <%-{-{-{-<