Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: RFC: "assignary" operator ?= :

by ikegami (Patriarch)
on Dec 07, 2019 at 17:03 UTC ( [id://11109812]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11109812]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-26 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found