use strict; use warnings; use Net::SSH::Perl; $ENV{'HOME'} = 'c:\strawberry'; my $ip = 'xxx'; my $user = '********'; my $pw = '********'; # If you use single quotes, only single quotes will to be escaped with '\' my $cs = Net::SSH::Perl->new($ip); if ($cs->login( $user, $pw)) { print $cs->cmd('sh run | inc hostname'); } else { warn "Unable to login\n"; } $cs->close;