in reply to How to use identity files in Net::SFTP

The error message you are getting suggests that Net::SFTP can't handle a hash reference. Since you have only one hash reference in your code this might be the problem.

Quick look into the source of Net::SFTP also seems to indicate that the old Net::SFTP version 0.08 did not accept hash references for the ssh_args parameter. So either use my %args =(ssh_args => [ user =>'XXXX', identity_files =>  '/home/myhome/zzz.private'  ] );, i.e. change the {} to [], or update Net::SFTP to a newer version.

No guarantee though, I didn't test it. If you still have problems, ask again