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

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

Thread Previous | Thread Next
From:
Eric Brine
Date:
January 1, 2010 16:59
Subject:
Re: [perl #69560] misleading warning: Use of uninitialized value in list assignment
Message ID:
f86994701001011659w651f245cue3c24bfc7a70e217@mail.gmail.com
On Fri, Jan 1, 2010 at 7:15 PM, Dave Mitchell <davem@iabyn.com> wrote:

> On Fri, Jan 01, 2010 at 05:42:57PM -0500, Eric Brine wrote:
> > I agree that "list assignment" is correct, but why does the warning say
> line
> > 2?
>
> Because perl currently only records line numbers per statement, not per
> op


I realize that, but it doesn't explain the difference between

>perl -lw
my %h = map {
   my $x;
   (undef, undef)
}
^Z
syntax error at - line 4, at EOF
Execution of - aborted due to compilation errors.

>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?


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