$ssh = Net::SSH::Perl->new($host,debug=>true,options => ["ConnectTimeout=5","StrictHostKeyChecking=no"]); $ssh_conf="$ENV{'HOME'}/.ssh/config"; $cfg = Net::SSH::Perl::Config->new($host); $cfg->read_config($ssh_conf); if (! $USERNAME){ $USER=$cfg->get('user'); } eval{$ssh->login($USER);}; if ($@){ print "Unable to connect to $host\n$@\n"; } eval{($out, $err, $exit)=$ssh->cmd($exec_cmd);};print "Unable to execute: $exec_cmd\n" if $@; ### print "\n\nmade it this far\n\n"; ### if ($out){ print $out; } else { print "$err\n$exit"; }