Using unless with regular expression : unless « Statement « Perl






Using unless with regular expression

   

while (<>) {
    chomp;
    unless (/^q/i) {
        print;
    } else {
        exit;
    }
}

   
    
    
  








Related examples in the same category

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