The unless Construct : unless « Statement « Perl






The unless Construct

  

print "How old are you? ";
chomp($age = <STDIN>);
unless ($age <= 21 ){  # If false, enter the block
    print "Let's party!\n";
}
print "You said you were $age.\n";

   
    
  








Related examples in the same category

1.Conditional operator: The unless Modifier
2.The unless statement is the opposite of if and executes a block unless a condition is true.
3.Using unless with regular expression
4.unless statement
5.unless statement in while
6.unless statement with else
7.unless statement with elsif