in reply to if else in the other way

You probably want something like this:

print $a == 6 ? 'yes' : 'no';