#!/usr/bin/perl use Net::SSH qw(sshopen2); use strict; my $user = "cosmicsoup"; my $host = "mybox.somewhere.com"; my $cmd = "df -k /data/staging"; sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die "ssh: $!"; while () { chomp(); print "$_\n"; } close(READER); close(WRITER);