open(my $ssh, "| ssh remote"); print $ssh "cd /home/remote/test"; print $ssh "cp test.txt /home/remote"; print $ssh "./perl.pl"; close($ssh) or die "$!";