Curt Shaffer wrote:
> #!/usr/bin/perl
> use warnings;
> use strict;
> my $hping;
> my $hping_compare;
> my @hping_array = ();
>
>
> for (1 .. 5){
>
> $hping = `sudo hping3 www.microsoft.com -S -p 80 -c 1`;
> push @hping_array,(split'\ ',$hping)[15];
> }
> $hping_compare = $hping_array[0];
>
> foreach (@hping_array){
> if ($_ le $hping_compare){
>
> print "Appears to be load balancing\n";
>
> }
# ignoring the fact that you were advised to use named variables
# instead of $_ where possible, here is one way to do it:
> elsif ($_ ge $hping_compare){
elsif ( ( $_ + 100 ) >= $hping_compare ) {
> print "Appears to be load balancing\n";
> }
> else{
> print "Does not appear to be load balancing\n";
> }
> }
Steve
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/