while ( my $proc = ) { ... $found_one = 1; } if ( $found_one ) { print "looks okay here\n"; found_one = 0; } else { print "couldn't find $process\n"; }