#!/usr/bin/perl use strict; use warnings; open(my $ssh, "| ssh topeg\@localhost"); print $ssh "echo HALLO\n"; print $ssh "cd /\n"; print $ssh "ls -l\n"; print $ssh "exit\n"; close($ssh) or die "$!";