The unless statement is the opposite of if and executes a block unless a condition is true. : unless « Statement « Perl






The unless statement is the opposite of if and executes a block unless a condition is true.

  

unless (condition) {
  # ...
}

or:

unless (condition) {
  # ...
} else {
  # ...
}

   
    
  








Related examples in the same category

1.Conditional operator: The unless Modifier
2.The unless Construct
3.Using unless with regular expression
4.unless statement
5.unless statement in while
6.unless statement with else
7.unless statement with elsif