> open (PS, "ps -ef|grep /usr/sbin/[n]amed |") or die "not spawn ps $!";
ps -ef works, so does grep... but if named isn't running (or /usr/sbin/[n]amed doesn't match it), you won't be able to read much from PS.

> for (;<PS>;) {
> push @arry, (split)[1];
> }
(Why not 'while (<PS>)' instead? It's the same number of characters and is more readable, IMO.)
If named isn't running, @arry will not grow.

> if (scalar @arry < 1) { ... }
named wasn't running so @arry == 0, and you try to run named.

> open (PSO, "ps -p$arry[0] -o vsz |")
Perhaps named is running now, but $arry[0] is still undef (so you get a warning about undef being used as '' -- which ps doesn't like, besides).

When you tried running named, you probably wanted to add named's pid to @arry, or do something else if it still isn't running even after you try to start it.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to