use warnings; use strict; use Perl::Critic; use Net::SSH::Perl; use Net::SSH::Perl::Key::RSA; use Class::ErrorHandler; my $server="400.800.400.800"; #not a real IP address my $port="22"; my $username="snoopy"; #my $command="df -h"; #this worked #my $command="ls"; #this worked #my $command="sh status.sh"; #Received error Use of uninitialized value $stdout in string at ssh.pl #my $command="/usr/bin/sh status.sh"; #Received error Use of uninitialized value $stdout in string at ssh.pl #my $command="qstat"; #Received error Use of uninitialized value $stdout in string at ssh.pl line my $command="pwd"; #this worked my $ssh = Net::SSH::Perl->new("$server", protocol=> 2, port=>"$port", identity_files=>["/location/of/my/identity/files/file"]); $ssh->login($username); my($stdout, $stderr, $exit) = $ssh->cmd("$command"); print "$stdout";