if ( ..A... ) { if ( ..B.. ) { if ( ..C.. ) { if ( ..D.. ) { print ..... } else { print ... } } else { if ( .. D2.. ) { ... you get the idea ... #### my $flag1 = cond1; my $prefix = (( cond2 ) ? "strting1" : "strring2"; ... print "$prefixA$suffixB" if ( condC );