in reply to undefined question
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: undefined question
by edan (Curate) on Jun 09, 2003 at 07:44 UTC | |
by chromatic (Archbishop) on Jun 09, 2003 at 17:08 UTC | |
|
Re: Re: undefined question
by Anonymous Monk on Jun 09, 2003 at 04:46 UTC |