in reply to Re^3: RFC: "assignary" operator ?= :
in thread RFC: "assignary" operator ?= :
It's a bit different than the if/else or ternary it's used to replace, though. Unlike them, the x!! evaluates the left hand side even if the condition is zero. Cf.
versusmy $t; sub tuple { $t++ => 12 } my $bool = 0; my %h = (tuple()) x !! $bool;
... my %h = $bool ? (tuple()) : ();
Now %h is the same, but $t is different.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: RFC: "assignary" operator ?= :
by shmem (Chancellor) on Dec 08, 2019 at 21:03 UTC |