while doing with the perl script I am stucked with the exit status of the ping command
The ping utility returns an exit status of zero if at least one response was heard from the specified host; a status of two if the transmission was successful but no responses were received; or another value (from ) if an error occurred.
http://www.manpagez.com/man/8/ping
The actual return values may depend on your system.
Fourth link down is this which states:
If ping does not receive any reply packets at all it will exit with code 1. If a packet count and deadline are both specified, and fewer than count packets are received by the time the deadline has arrived, it will also exit with code 1. On other error it exits with code 2. Otherwise it exits with code 0. This makes it possible to use the exit code to see if a host is alive or not.
To list the results:
- Success: code 0
- No reply: code 1
- Other errors: code 2
Note that the page I link to says "Linux/Unix ping command", but other systems, or perhaps even variants of Linux and Unix, might vary this value.
If possible, I would test on the system in question to make sure you have the right ones.
Try man ping
from the command line. The return values are listed near the bottom.
No, they are not. For example GNU ping seems to return 255 if you did not give it enough time to send all packets. This seems to be documented nowhere.