Perl Postfix Control Constructs

Tutorial Difficulty Level    

Control statements in Perl can also be written with the conditional following the statements (called “postfix”). This syntax functions (nearly) identically to the usual one you would expect.


statement if Boolean expression;
statement unless Boolean expression;
statement while Boolean expression;
statement until Boolean expression;
statement foreach list;

Here’s a working example: