my $result = `$command`; my @lines = split /\n/, $result; for(@lines) { next if //; next if !/\S/; print "$_\n"; }