use Net::SSH2; [...] my $ssh2 = Net::SSH2->new(); [...] my ($code, $name, $string) = $ssh2->error; print "Error ($code): $name - $string\n";