If there's no output from the pipe open, there'll be nothing read from PROCS, so your loop won't execute. You could set a flag:
my $output; while (<PROCS>) { $output++; # do something else } print "Couldn't find $process\n" unless $output;
The a Proc::ProcessTable module might be another approach.
Update: I forgot to mention that your loop will not execute if a line evaluating to false in boolean context is read — that may not be a problem in this case, but it's worth remembering.
In reply to Re: undefined question
by chromatic
in thread undefined question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |