Questions about this topic? Sign up to ask in the talk tab.

Perl/Basics/Boolean Logic/Statements/Unless

From NetSec

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

An unless statement may only have the unless clause and an else clause.

unless ($age >= 21) {
    print "All content is restricted for users under the age of 21.\n";
} else {
    print "Welcome to our sample age gate!\n";
    display_content();
}