ITeye博客

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

wind9984 · 2011-08-12 10:46 · Perl · 编程语言 · Perl · 程序控制 · Markdown

#!/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"

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。