use strict; use warnings; use IPC::PerlSSH; eval { $SIG{PIPE} = sub { die "pipe dreams"; }; my $ips = IPC::PerlSSH->new( Host => "localhost" ); print $ips->eval("1")."\n"; <>; # allow me to cut ssh connection print $ips->eval("2")."\n"; }; if ($@) { print "error: $@"; } print "done\n";