Sure, but you can't invent your own syntax, you have to use perl's.
In perl, commas are not comma-colons I mean colon-commas semicolons . You can't just plop an if(){}statement into the middle of an expression (What is the difference between a Statement and an Expression?). if is a control structure (a block) , it controls the flow of the program (branch/decision).
But, you can do what you were thinking of with a do-block, or switch to the Conditional Operator (mini-if, ternary, trinary, terrychilds)