If so, how print "TTL = $line\n" does give me the right value ! (I get TTL = 125 if ping to Windows machine.
Thanks, for your answers. On Jan 21, 4:30 pm, rob.di...@gmx.com (Rob Dixon) wrote: > On 21/01/2011 05:50, Erez Schatz wrote: > > > > > On 20 January 2011 15:38, Eyal B.<ewinst...@gmail.com> wrote: > > >> I'm getting an error on the line where I should use the TTL variable - > >> and take the right value from the hash (%list) :Use of uninitialized > >> value in print at D:\system\perl\os-rec\os-rec5_.pl line 24 > >> ,<HANDLE> line 3. > > >> Any idea ? > >> if("$line" =~ "TTL=") > >> { > >> $line =~ s/.*TTL=//; > >> print "TTL = $line\n"; > >> print $list{"$line"} ; > >> # print "Machine $machine_IP is > >> $list{$line}" ; > >> last; } > > > Assuming a specific line is made of nothing but TTL=, then $line =~ > > s/.*TTL=//; will erase the line, leaving you with an empty > > (uninitialized) $line variable. > > No it won't, it will leave $line containing a null (zero-length) string. > There is no way to change a string value to uninitialized (undef) by > deleting characters from it. > > - Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/