Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^7: uninitialized values

by Random_Walk (Prior)
on Aug 20, 2013 at 09:44 UTC ( [id://1050168]=note: print w/replies, xml ) Need Help??


in reply to Re^6: uninitialized values
in thread uninitialized values

You really need to use some helpful names for your variables. I started to work on your code and gave up because while I have a good idea what this means:

print "$hostname\n"; print "$ip\n"; print "$pkt_size\n"; print "$ttl\n";

it will take me some time to work out what this means:

#print "$values1[1] \n"; # print "$val1[0] \n"; #print "$val1[1] \n"; #print "$val2[1] \n";

I would suggest, other than using sane variable names, that you alter your series of if statements to use the if/elsif/else construct. This will give you a way to catch the error conditions from your ping.

On a more minor point, it looks like you only allow a restricted range of IP addresses for your $host value. Yet later you capture the IP used by ping. Is there a case where you ask it to ping n.n.n.n and it pings m.m.m.m? If not you can just use the IP you fed into it.

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1050168]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-23 06:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found