http://www.perlmonks.org?node_id=862046


in reply to A matter of style: how to perform a simple action based on a simple condition?

Using the and && is too much about the implementation. Use it in shell programs where you're grateful for a concise alternative to if{} blocks.

Use the if{} if you are going to do several things within the block, or if you are also going to use the else clause.

If what is being done is significant, the suffix if focuses on what is being done, rather than why. If the what is minor, the reason is still notable, while far more compact.

What I mean is, if you are processing a config file, you want to skip empty lines, ignoring space characters, and ignoring comment lines.

LINE: while ( my $line = <config> ) { chomp $line; next LINE unless $line =~ m{\S}; next LINE if $line =~ m{\a\s*\#}xms; # process line }

As Occam said: Entia non sunt multiplicanda praeter necessitatem.