while ( my $proc = ) { # if the grep filters out everything, this is a # zero-trip loop. } #### my $found_one = 0; while ( my $proc = ) { ... $found_one = 1; } if ( $found_one ) { print "looks okay here\n"; } else { print "couldn't find $process\n"; }