Perl Postfix Control Constructs

Watch out! This tutorial is over 2 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.
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: