in reply to How move on to next ip if no connection got established?

As long as you are on a unix system that handles signals you can use this:
$seconds_allowed_to_do_task = 5; foreach (@list_of_things_to_do) { eval { local $SIG{ALRM} = sub { die "dead"}; alarm $seconds_allowed_to_do_task; &doTask($_); alarm 0; }; }
The eval loop get's killed by the "die" after the alarm goes off (if it does). So just put your IP address in the list, and make doTask be the function that does your http connection. -Henri