title: "Uninitialized value" false positive
body: <p>I think that PERL (5.8.8 on CentOS kernel 2.6.18-308.8.1.el5) is giving me a false positive 'uninitialized variable' warning. All of my searching turns up legitimate uninitialized value problems. Perhaps mine is too, and if that's the case then an explanation of what's going on (and how to correctly do what I'm trying to do) would be awesome. I've also looked at many references for hex() and correct function argument idioms, and I think I'm doing all of that correctly.</p>
  
  <p>My script reads 2 text files: one contains 32bit hardware address and the other contains 32bit data read back from that address. The values in each file are always 8 hex digits long and both files are 100% matched (line 1 in the Address file corresponds to line 1 in Data file). When the data value is non-zero everything is fine, but when the data value is 0 I get the warning:</p>
  
  <pre><code>Use of uninitialized value in string eq at ../VMetro_Parser.pl line 248.
  Use of uninitialized value in hex at ../VMetro_Parser.pl line 250.
  </code></pre>
  
  <p>Relevant code:</p>
  
  <pre><code>sub ppReg_TX_Mode_Reg {
      my( $data ) = @_; # first arg should be the Data field
      my $ret = "\t";
      if( $data eq "00000000" ) { print "TX_Mode_Reg got 0 input\n"; } #LINE 248
      #croak( "data not defined!" ) unless defined $data;
      my( $hex ) = hex($data); #LINE 250
  
      $ret .= sprintf( "Clear INTs: %02X   ",         (($hex &gt;&gt; 25) &amp; 0x7F) );
  </code></pre>
  
  <p>Input that produces expected behavior:</p>
  
  <pre><code>Address: 90000004
  Data: 00000004
  </code></pre>
  
  <p>Output of PERL script:</p>
  
  <pre><code>90000004 00000004 -&gt;  Wr TX00 Mode_Reg
      Clear INTs: 00
  </code></pre>
  
  <p>Input that produces the unexpected 'uninitialized value' warning:</p>
  
  <pre><code>Address: 90000004
  Data: 00000000
  </code></pre>
  
  <p>Output of PERL script:</p>
  
  <pre><code>90000004 00000000 -&gt;  Wr TX00 Mode_Reg
  TX_Mode_Reg got 0 input
      Clear INTs: 00
  </code></pre>
  
  <p>Clearly, it is recognizing an argument passed in as the string "00000000" and yet it also thinks it is undef (the croak line fires if I uncomment it). What gives?</p>
  
  <p>One interesting thing is that there are other instances of the data being 0 but no warnings are thrown. This other 0 data is processed by a different function, and occurs after the line that throws the warning, but the processing is identical (except for the obvious debug actions in the code above, that were only added because of the warning).</p>
  
  <p>E.G.</p>
  
  <pre><code>sub ppReg_RX_Master_Mode_Reg {
      my( $data ) = @_; # first arg should be the Data field
      my $ret = "\t";
      my( $hex ) = hex($data);
  </code></pre>
  
  <p>Does not throw any warnings.</p>