Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^6: Useless use of string in return statement

by Tux (Canon)
on Apr 13, 2021 at 16:20 UTC ( [id://11131205]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Useless use of string in return statement
in thread Useless use of string in return statement

But what *is* the most important part with errors?

die "I hate you" if $string =~ m/error/i;

or

$string =~ m/error/i and die "I hate you";

As with most, it is a matter of taste and brain. *My* brain 100% prefers the second over the first. Note that I am not of native English tongue. That might matter.

My rule of thumb is to forbid all postfix if/unless except when the expression is a simple $debug / $verbose >= $n.


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^7: Useless use of string in return statement
by jdporter (Paladin) on Apr 13, 2021 at 16:28 UTC

    I agree... and now I realize that I mis-wrote when I said "modifier if". I actually meant 'and', as you showed.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-19 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found