Avoid Yoda conditions in Perl you should
I remember a brief time in the mid-2000s insisting on so-called “Yoda conditions” in my Perl. I would place constants to the left of equality comparisons. In case I accidentally typed a single =
instead of ==
, the compiler would catch it instead of blithely assigning a variable. E.g.:
if ( $foo == 42 ) { ... } # don’t do this
if ( 42 == $foo ) { ... } # do this
if ( $foo =…