http://www.perlmonks.org?node_id=1050091


in reply to uninitialized values

Use of uninitialized value $val in concatenation (.) or string at ./ping_linux.pl line 69, <CMD> line 2.

Your warning message is about an unitialized $val variable, but you are not using any such variable in the code you have posted (you're declaring one, but not using it).

The waning message also mentions line 69 of your code, the code you display is about 15 lines. How do you expect us to tell you what is wrong in line 69 if you don't show it to us?

Please give us line 69 of your code, or give us a correct warning message. You need to be very accurate on these types of things if you want us to be able to help. Please help us to help you.

In addition to other problems indicated by others (and using meaningful variable names is really not a luxury, we could understand much better what you are trying to do if your variables names would tell us what they are intended to contain; to me using meaningful names for variables, subroutines, etc. is the most important form of code comment), I also doubt quite a bit that the following lines (at least the two last ones) do what you want:

@values1 = split ; @val1 = split(/\(/,$values1[3]); $val1[1] =~ s/\)//;

Please supply a sample of the ping command output, so that we can figure out what these code lines are supposed to do. Also you don't use $val1[1] after having assigned it, what's the point?

BTW, the fact that you have this warning on line 2 possibly simply means that the second line of your input is empty.