There's a shorthand notation for an IF-ELSE conditional block EXPR ? EXPR_IS_TRUE : EXPR_IS_FALSE For example $happy = 1; print $happy ? ":^)\n" : ":^(\n"; Use sparingly (it is harder to read)