develooper Front page | perl.perl5.porters | Postings from April 2018

Re: [perl #133143] Warning when list assignment RHS is a scalar

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
April 23, 2018 14:17
Subject:
Re: [perl #133143] Warning when list assignment RHS is a scalar
Message ID:
20180423141655.GL597@iabyn.com
On Mon, Apr 23, 2018 at 06:53:44AM -0700, Ed Avis wrote:
> This is probably a mistake:
> 
>     ($foo, $bar) = $baz;
> 
> In my case it usually means that I wanted @{$baz} instead.
> For other programmers there might be some other reason.
> But surely it cannot be intentional.

A quick grep shows for example in ExtUtils-Install,

   my ($key, $data) = $line;

where from the context it seems likely that the intent is

    my $data;
    my $key = $line.

Which makes the code both correct and intentional.

-- 
In England there is a special word which means the last sunshine
of the summer. That word is "spring".

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