-----Original Message-----
From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 21, 2006 11:53 AM
To: beginners@perl.org
Subject: RE: uninitialized value error

Smith, Derek wrote:

: I am getting the following error yet the script is doing what
: I need it to do restart a process: 
: 
: Use of uninitialized value at /usr/local/admin/named_monit.pl
: line 71 (#1)

    It seems that when the test on line 64 is true, $arry[0] is
not defined (and not initialized) and throws this error.


HTH,

Charles K. Clarkson
*****************************************************************

I thought that was the problem initially but tested it and I do see this
element populated on lines 64 and 65

   61          for (;<PS>;) {
   62              push @arry, (split)[1];
   63          }
   64  print $arry[0],"\n";
   65  print scalar @arry,"\n";
   66
   67         if (scalar defined @arry < 1) {
   68             print LOG "named was not running, now restartng\n",
dateme();
   69             system ("echo named dubdns02|mailx -s named $oncall");
   70             system ("/sbin/init.d/named start");
   71         }
   72  print $arry[0],"\n";
73
   74         open (PSO, "ps -p$arry[0] -o vsz |") or die "unable to
spawn ps -
p $!";
   75
   76         foreach (<PSO>) {
   77             if (/\d+/) {
   78                 if ($_ >= VSZ) {
   79                    print LOG "named vsz reached over 60mb",$_,"now
stoppi
ng & starting\n";
   80                    print LOG dateme(),"\n";
   81                    namedchk();
"named_monit.pl" 91 lines, 2742 characters

__
__OUTPUT__

7431 is the PID.

csdns03# perl named_monit.pl
7431
1
7431

_________________________________________________

This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the email by you is prohibited.

Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk 
- Portuguese - Svenska: www.cardinalhealth.com/legal/email

--
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