On Thu, Jun 13, 2002 at 11:31:07PM +0200, Stefan `Sec` Zehl wrote:
> The shortest test case i found is:
> 
> | ice:~>echo a |perl5.6.1 -we 'print "$1"'
> | Use of uninitialized value in string at -e line 1.
> | ice:~>echo a |perl5.6.1 -we 'print "$1\n"'
> | 
> | ice:~>echo a |perl5.6.1 -we 'print ".$1\n"'
> | Use of uninitialized value in concatenation (.) or string at -e line 1.
> | .
> 
> just for a quick check, my normal perl behaves as expected:
> 
> | ice:~>echo a |perl5.00503  -we 'print "$1\n"'
> | Use of uninitialized value at -e line 1.
> 
> Now if somebody could explain to me how and why this happens?

Bug.  The history is someone noticed that since this:

      my $foo;  $foo = $foo . 42
      Use of uninitialized value at -e line 1.

and this:

      my $foo;  $foo .= 42

are logically the same, the former shouldn't warn.  So that was changed in
5.6.0.  Trouble is this:

      my $foo;  print "$foo 42";

literally reduces to the same opcodes as this:

      my $foo;  print $foo . ' 42';

so the warning was implicitly removed from "$some_var stuff" in 5.6.1.
This has been fixed in 5.8.0.

$ perl5.8.0 -wle 'my $foo;  print "$foo 42"'
Use of uninitialized value in concatenation (.) or string at -e line 1.
 42


-- 
This sig file temporarily out of order.

Reply via email to