in reply to Re^2: RFC: "assignary" operator ?= :
in thread RFC: "assignary" operator ?= :

$var1 ?= die "ERROR: \$var1 already set." : $var2;

would be far clearer as

die "ERROR: \$var1 already set." if $var1; $var1 = $var2;

Replies are listed 'Best First'.
Re^4: RFC: "assignary" operator ?= :
by Tux (Canon) on Dec 07, 2019 at 17:27 UTC

    Personally I feel this just obfuscates the problem at hand, but I dislike/hate statement-modifiers in general.

    $var1 and die "ERROR: ..."; $var1 = $var2;

    To **me** is extremely better readable (and thus maintanable) than your suggestion. TIMTOWTDI.


    Enjoy, Have FUN! H.Merijn

      Personally, I despise people that hide die and other flow control statements. (Put a line break before the and and a blank line after die!)

      Either way. The point is the separation of the two actions.