in reply to Update on script

It would appear that you are writing this script partly to learn some Perl, which I certainly wouldn't want to discourage :)

However, in doing so you are re-inventing a wheel that you really don't need to. There are stacks of open source Network Management Systems already out there that will do exactly want you want, right out of the box.

One in particular that I would recommend is Big Brother. It's extremely easy to install and configure, and includes ping and http tests as standard features (and much more). And the thing that I particularly like about Big Brother is that it's quite easy to write your own customised plug-in tests (in Perl, of course).

I'd really encourage you to take a look at it.

Cheers,
Darren :)

PS. No, I am in no way associated with BB, but I've been using it for several years and I really like it :)