#!/usr/bin/perl
foreach (1..10) {
print "Iteration number $_.\n\n";
print "Please choose: last, next, redo, or none of the above? ";
chomp (my $choice = <STDIN>);
print "\n";
last if $choice =~ /last/i;
next if $choice =~ /next/i;
redo if $choice =~ /redo/i;
print "That wasn't any of the choices... onward~\n\n";
}
print "That's all, folks!\n";
# ./redo2.pl
Iteration number 1.
Please choose: last, next, redo, or none of the above? next
Iteration number 2.
Please choose: last, next, redo, or none of the above? next
Iteration number 3.
Please choose: last, next, redo, or none of the above? redo
Iteration number 3.
Please choose: last, next, redo, or none of the above? next
Iteration number 4.
Please choose: last, next, redo, or none of the above? ^C
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |