Readonly my $udp_pinger => Net::Ping->new( 'udp', 1 ); Readonly my $syn_pinger => Net::Ping->new( 'syn', 1 ); foreach my $x ( 0 .. 5 ) { #test the syn prot with two loops my $t0 = [ gettimeofday() ]; foreach my $host (@host_list) { $syn_pinger->ping($host) || die "syn ping failed for $host"; } foreach my $host (@host_list) { $syn_pinger->ack($host) || die "syn ack failed for $host"; } my $e0 = tv_interval($t0); print "$e0 seconds to ping $NUM_HOSTS hosts with syn"; #test the udp prot with one loop $t0 = [ gettimeofday() ]; foreach my $host (@host_list) { $udp_pinger->ping($host) || die "udp ping failed for $host"; } $e0 = tv_interval($t0); print "$e0 seconds to ping $NUM_HOSTS hosts with udp"; print "---------------------------"; } ## end foreach my $x ( 0 .. 5 )