Hello guys,
I would like having new type of assignment operator in perl, the combination of assignment and ternary operator (therefore calling it "assignary"):
?= :Not in context of regular expressions, not related with (?=) in any way, but in regular assignment. I haven't found something like that in perlop.
Suggested meaning:
$var ?= "something" : "something else";would be equivalent to:
$var = $var ? "something" : "something else";Advantage of the first: more compact, as not writing $var two times.
What do you think about possible existence of such hybrid of ternary and assignment operators?
Back to
Meditations