Re: execute and analyze unix command with perl

2010-05-28 Thread C.DeRykus
On May 27, 11:09 am, robertmorales...@gmail.com (Robert Morales) wrote: > Ok, now I added the: > >        my $regex = "^((?!total).)*\$"; > Using the 'qr' operator is a more efficient option (see "Regexp Quote-Like Operators " in perlop) and will take care of the $: my $regex = qr/^((?!total).)*$

Re: execute and analyze unix command with perl

2010-05-27 Thread John W. Krahn
Robert Morales wrote: Ok, now I added the: my $regex = "^((?!total).)*\$"; I also removed the " " from the numbers in the if test: if ($array[6] >= 867580){ The error msg I get this time, is like this: r...@user# ./script.pl 0 Use of uninitialized value $array[6] in numeric ge

Re: execute and analyze unix command with perl

2010-05-27 Thread Brandon McCaig
On Thu, May 27, 2010 at 2:09 PM, Robert Morales wrote: > The error msg I get this time, is like this: > > r...@user# ./script.pl > 0 > Use of uninitialized value $array[6] in numeric ge (>=) at ./script.pl line > 21, <$memory> line 3. > Use of uninitialized value $array[6] in numeric ge (>=) at ./

Re: execute and analyze unix command with perl

2010-05-27 Thread Robert Morales
Ok, now I added the: my $regex = "^((?!total).)*\$"; I also removed the " " from the numbers in the if test: if ($array[6] >= 867580){ The error msg I get this time, is like this: r...@user# ./script.pl 0 Use of uninitialized value $array[6] in numeric ge (>=) at ./script.pl lin

Re: execute and analyze unix command with perl

2010-05-27 Thread Brandon McCaig
On Thu, May 27, 2010 at 12:48 PM, Robert Morales wrote: > Final $ should be \$ or $name at ./script.pl line 11, within string > syntax error at ./script.pl line 11, near "= "^((?!total).)*$"" > Execution of ./script.pl aborted due to compilation errors. > > It might be something with the regex, bu

Re: execute and analyze unix command with perl

2010-05-27 Thread Robert Morales
Tnx Guys! the $vgs variable is of course and error and should be $memory. After adding your suggestions, I ran the script over again and got this error: r...@user# ./script.pl Final $ should be \$ or $name at ./script.pl line 11, within string syntax error at ./script.pl line 11, near "= "^((?!to

Re: execute and analyze unix command with perl

2010-05-27 Thread Jim Gibson
On 5/27/10 Thu May 27, 2010 9:27 AM, "Robert Morales" scribbled: > Hi, > > I want my code to execute the unix free command in order to analyze > the memory state, and issue a warning if the cached memory increases. > I don`t know what I did wrong, but this is what I got for now: > > #! /usr/b

Re: execute and analyze unix command with perl

2010-05-27 Thread Shlomi Fish
On Thursday 27 May 2010 19:27:46 Robert Morales wrote: > Hi, > > I want my code to execute the unix free command in order to analyze > the memory state, and issue a warning if the cached memory increases. > I don`t know what I did wrong, but this is what I got for now: > > #! /usr/bin/perl > use

execute and analyze unix command with perl

2010-05-27 Thread Robert Morales
Hi, I want my code to execute the unix free command in order to analyze the memory state, and issue a warning if the cached memory increases. I don`t know what I did wrong, but this is what I got for now: #! /usr/bin/perl use warnings; use strict; # return codes $ok = 0; $warning = 1; $critical