my @cmd = (cat => ( '/etc/passwd', )); my @sshcmd = ('/usr/bin/ssh' => ( -t => (), -i => "$HOME/.ssh/mypubkey", -o => 'StrictHostKeyChecking no', 'user@host', @cmd )); open(my $fr_ssh, '-|', @sshcmd) or die("Can't fork and pipe: $!\n");