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.