Firstly, I would question why you are using a lock file at all, as it wouldn't seem to matter to me if this runs a few times. At worst, you're getting a double page -- but that may not be such a bad thing.
Secondly, one way to make sure that your script created the lock file is to create a directory in temp, protected by your username (chmod 700), and create your lock file inside. When your script is finished, it can leave the dir, or delete it.
Other than that, the script looks fine to me. For only speaking perl for 5 days, it's quite good. You may want to look into the module
Net::Ping on
CPAN.
Cheers,
Shendal