>>>>> "CS" == Curt Shaffer <[email protected]> writes:

  CS> #!/usr/bin/perl
  CS> use warnings;
  CS> use strict;
  CS> my $hping;
  CS> my $hping_compare;
  CS> my @hping_array = ();

no need for the = () as all arrays are created empty.

  CS> for (1 .. 5){

  CS>         $hping = `sudo hping3 www.microsoft.com -S -p 80 -c 1`;
  CS>         push @hping_array,(split'\ ',$hping)[15];
  CS> }
  CS> $hping_compare = $hping_array[0];

  CS> foreach (@hping_array){
  CS> if ($_ le $hping_compare){

someone told you that le is wrong for numeric comparison. and WHAT do
you think is in $_ there? you never explicitly set it. it may have some
value from the loop index but that is meaningless. think about your data
when you use it. was it set properly? what should it contain? print it
to make sure.

  CS> So now there is my new code. It all runs as expected and the with
  CS> the suggestions of Uri. The problem still remains that I cannot
  CS> find any documentation or search results on how one would compare
  CS> as I have asked from the beginning. I need the ge value to be
  CS> greater than by 100. If it is not greater than by 100, then it is
  CS> a different value.

ge is for string compare. >= is for numeric.

uri

-- 
Uri Guttman  ------  [email protected]  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to