develooper Front page | perl.perl5.porters | Postings from October 2016

Re: Extend the fat comma to deal with undef

Thread Previous | Thread Next
From:
Tony Cook
Date:
October 6, 2016 23:07
Subject:
Re: Extend the fat comma to deal with undef
Message ID:
20161006230702.GM21825@mars.tony.develop-help.com
On Thu, Oct 06, 2016 at 05:50:40PM -0500, David Nicol wrote:
> Without testing or consulting documentation, I understand that one of the
> things fat-comma does is put its left side in SCALAR context. That can be
> used to make your example do what you want, by using fat commas between the
> pairs instead of just between the keys and values.

It doesn't:

$ perl -MData::Dumper -e 'sub x {} %x = ( foo => x() => bar => 1 ); print Dumper(\%x)'
$VAR1 = {
          'foo' => 'bar',
          '1' => undef
        };

=> only differs from the comma operator in that it quotes identifiers
given as its left argument.

Tony

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