http://qs1969.pair.com?node_id=862038

muba has asked for the wisdom of the Perl Monks concerning the following question:

After having written a couple of programs in a not very well known programming language that usually employs a style of some_variable && some_subroutine() to run a subroutine only when some_variable holds a true value, I find myself doing the same in Perl often lately.

But then I realised that Perl also has the some_subroutine if $some_variable syntax, and of course the filled with line noise version, if ($some_variable) { some_subroutine }.

All of these have pros and cons, I think.

One
$var && subroutine: this one follows the way you formulate logic propositions: it is immediately apparent that subroutine() is only called when $var is true. However, readability might suffer a bit as it appears a bit "cryptic", especially compared to snippet two

Two
subroutine if $var: flows like natural language, woohoo! However, the fact that subroutine() is called when $var is true is only revealed at the end of the statement.

Three
if ($var) { subroutine }: has the advantage of snippet one (condition first, consequence next), but is filled with line noise. ( ) { } just for a really simple 'IF this THEN that' kind of construction.

Obviously, the TIMTOWTDI principle applies here but what I've come to ask is which of these styles do you prefer, and why? Just out of curiousity.