in reply to
How to print list using Net::SFTP::Foreign
Adding use strict; at the beginning of your script (and fixing everything it subsequently complains about) would likely have pointed you directly at the problem.
According to Net::SFTP::Foreign, $sftp->ls($remote, %opts):
Returns a reference to a list of entries. Every entry is a reference to a hash with three keys: ...
# List remote directory contents
should not have the @
in front of $remotefiles