open(EXEC, '-|', 'ps', '-deaf | ', 'grep', 'httpd |', 'grep', '-v', 'grep |', 'wc', '-l') or die "Can't exec: $!\n"; # Now read the output just like a file while(my $line = ) { chomp $line; print "$line\n"; } close(EXEC);