On Feb 4, Lorne Easton said:
>Here is some code that I have written. I know that there is a better way
>of writing this. As it stands the code between the "#Evaluation code"
>does not work as desired. I cannot seem to get these if ((case1) and
>(case2)) type statements to work. How would I and what am I doing wrong?
>Also, is there a better way of doing this?
>#Host was down and is now back up
>if (($host_state eq 1) and ($failed_pings[$host_number] ge $max_failed))
>{
> print "Host: $hostname is up.\n";
> #$failed_pings[$host_number] = 0;
>}
You are using STRING operators for NUMBERS. Do not do this. Use ==
instead of eq, >= instead of ge, < instead of lt, etc. The proper
operators can be found in 'perldoc perlop'.
> if ($host_number lt $#host)
Are you sure you want $#host and not @host?
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]