Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^7: uninitialized values

by Random_Walk (Prior)
on Aug 20, 2013 at 09:44 UTC ( #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.


Pereant, qui ante nos nostra dixerunt!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2018-08-20 12:40 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (191 votes). Check out past polls.