my $ssh = Net::SSH::Perl->new( $server ); if ( $ssh->login( "user", "pass" ) ) { my ( $stdout, $stderr, $exit ) = $ssh->cmd("ps -ef |grep \"$proc\" |grep -v grep"); } else { print "ERROR"; }