慧9建 发表于 2017-5-19 09:58:19

Perl 的last ,next ,redo 程序控制操作

#!/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 was't any of the choices. onward!\n\n";
}
print "That's all, folks\n"

 
页: [1]
查看完整版本: Perl 的last ,next ,redo 程序控制操作