G'day MP,
Net::SSH::Perl->new( $host, [identity_files => [$keyfile]);
It's best to copy-paste code rather than type it manually; I'm assuming that's what you did and introduced a typo.
$ perl -MO=Deparse -e 'Net::SSH::Perl->new( $host, [identity_files => +[$keyfile]);' syntax error at -e line 1, near "])" Missing right curly or square bracket at -e line 1, at end of line -e had compilation errors.
So, perhaps your real code has (completely guessing):
Net::SSH::Perl->new( $host, [identity_files => [$keyfile]]);
Regardless, if you look at the Net::SSH::Perl doco, you'll see
Net::SSH::Perl->new($host, %params)
And, further down in the description of %params: "identity_files ... a reference to an array of strings ...". There's more information there, which you should read, but it would seem that you really want:
Net::SSH::Perl->new($host, identity_files => [$keyfile]);
— Ken
In reply to Re: Why does Net::SFTP and Net::SSH::Perl not use "known_hosts"
by kcott
in thread Why does Net::SFTP and Net::SSH::Perl not use "known_hosts"
by misterperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |