develooper Front page | perl.perl5.porters | Postings from January 2010

Re: [perl #69560] misleading warning: Use of uninitialized valuein list assignment

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
January 2, 2010 06:09
Subject:
Re: [perl #69560] misleading warning: Use of uninitialized valuein list assignment
Message ID:
20100102140918.GB32153@iabyn.com
On Fri, Jan 01, 2010 at 08:02:19PM -0500, Eric Brine wrote:
> I realize that, but it doesn't explain the difference between
> 
> >perl -lw
> my %h = map {
>    my $x;
>    (undef, undef)
> } 1;
> ^Z
> Use of uninitialized value in list assignment at - line 2.
> 
> and
> 
> >perl -lw
> my %h = (
> 
>    (undef, undef)
> );
> ^Z
> Use of uninitialized value in list assignment at - line 1.
> 
> The assignment didn't move, so why did the warning?

Because perl's line number reporting is totally borked and needs ripping
out and rewriting from scratch. The line number that is reported is based
on what is stored in what happens to have been last nextstate op to have
been executed, and there isn't even a guarantee that the value in that op
corresponds to the line number where the statement boundary occurred.

-- 
Standards (n). Battle insignia or tribal totems.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About