We don't bite newbies here... much | |
PerlMonks |
Re^3: RFC: "assignary" operator ?= :by LanX (Saint) |
on Dec 07, 2019 at 16:49 UTC ( [id://11109811]=note: print w/replies, xml ) | Need Help?? |
> not ternary, just "binary", yes it's binary. > $var1 ?= die "ERROR: \$var1 already set." : $var2; Thanks for demonstrating your use case, it's even stranger than I expected! ;-) die will not return a value - actually it won't return at all. > Maybe you'll see more elegant way how to do such thing. Yes with a properly named custom-function operating on an alias. something like
Please note the defined° , cause else wise you'd miss false values like 0 or "". (which renders your requirement for a new operator a bit useless)
UPDATE:
Cheers Rolf
Off by one, it's the inverted case :)
In Section
Meditations
|
|