in reply to if else in the other way

Your first code doesn't have an "else".

Yes, Perl does have the ternary operator like in C, but in a practical sense there is no difference in performance between that and "if", "else". Write the code that is the easiest to understand for you and the folks who will have to understand the code later. Spacing and indenting do matter..this is part of the art of programming.

How "short" the code is, often just doesn't matter at all. How clear the code is, always matters. And that matters more than some "one size fits all coding standard". The code below just has different spacing than your 2nd version, but I hope the difference is clear.

my $a = 2; if ($a == 6) {print "yes" } else {print "no" }