... my $pid = fork(); # spawn child if ( $pid ) { # parent while ( wait != -1 ) { while (<>) { print "Got $_ on STDIN\n"; } } } else { # child while ( 1 ) { print $header; print `ps guw | sort -n -r -k $sort_option | head -$num_lines`; print "\nSort: $sort_option : Lines: $num_lines : Sleep: $sleep_time\n"; sleep $sleep_time; print `clear`; } }