---
title: "Perl 的last ,next ,redo 程序控制操作"
author: "wind9984"
date: "2011-08-12T10:46:33Z"
tags: ["Perl", "程序控制"]
categories: ["编程语言"]
slug: "perl-last-next-redo"
draft: false
lastmod: "2011-08-12T10:46:33Z"
id: 1147133
url: "https://ilikedo.iteye.com/blog/1147133"
---

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