Using exit command to exit an program : exit « System Functions « Perl






Using exit command to exit an program

      

print "Please type the letter y\n";
while (<>) {
    chop;
    if ($_ ne 'y') {
        print "Please type the letter y\n";
    } else {
        print "Do you always do what you're told?\n";
        exit;
    }
}

   
    
    
    
    
    
  








Related examples in the same category

1.To exit a Perl script, use the die function or the exit function.