I would like to check and see if various "ports" or "services" are up or down on a certain server. I can do this with PHP, but the server where this script needs to run only allows perl. Unfortunately I don't know anything about perl, although I'm learning slowly.

Here's what I need in speudo-code:

1) Able to specify a list of services to check. This would be a mulit-dimensional array that allows for specificaiton of "port number" and its associated "description".

So the array might look like this:
1 | 21 | ftp
2 | 80 | http
3 | 1990 | database1
4 | 1995 | database2
2) For each element in the array, the script should try to open a socket connection to the port and see if a connection is possible. If the connection is not possible, then print out something like, "ftp on port 21 was not available". (Where "ftp" is the description associated with that port number.)

If a connection is possible, then something like "ftp on port 21 is available".

In this way, I would be able to specify a list of port numbers/description and be able to see a listing of what is "up" an what is "down".