my @id_files = qw(/home/me/.ssh/id_rsa.pub); my $ssh = Net::SSH::Perl->new( 'host', debug => 1, protocol => 2, identity_files => \@id_files ); $ssh->login() my ( $o, $e, $ex ) = $ssh->cmd( 'uptime' ); #### host: Trying empty user-authentication request. host: Authentication methods that can continue: publickey,keyboard-interactive. host: Next method to try is publickey. host: Trying pubkey authentication with key file '/home/me/.ssh/id_rsa.pub' host: Will not query passphrase for '/home/me/.ssh/id_rsa.pub' in batch mode. Loading private key failed.