my ($out, $err1, $exit2) = $ssh->cmd("df -k"); for my $line (split /\n/, $out) { print "$cnt: $line\n"; $cnt++; }