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

Re: Extend the fat comma to deal with undef

Thread Previous | Thread Next
Tony Cook
October 6, 2016 23:07
Re: Extend the fat comma to deal with undef
Message ID:
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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About