Learning Perl by Randal L. Schwartz; brian d foy; Tom Phoenix
Author:Randal L. Schwartz; brian d foy; Tom Phoenix
Language: eng
Format: mobi
Tags: COMPUTERS / Programming Languages / Perl
ISBN: 9781449304584
Publisher: O'Reilly Media
Published: 2011-06-16T18:30:00+00:00
foreach (@words) {
## redo comes here ##
print "Type the word '$_': ";
chomp(my $try = <STDIN>);
if ($try ne $_) {
print "Sorry - That's not right.\n\n";
$errors++;
redo; # jump back up to the top of the loop
}
}
print "You've completed the test, with $errors errors.\n";
Like the other two operators, redo will work with any of the five kinds of loop blocks, and it will work with the innermost loop block when they’re nested.
The big difference between next and redo is that next will advance to the next iteration, but redo will redo the current iteration. Here’s an example program that you can play with to get a feel for how these three operators work:
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";
}
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12592)
Hello! Python by Anthony Briggs(9928)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9802)
The Mikado Method by Ola Ellnestam Daniel Brolund(9787)
Dependency Injection in .NET by Mark Seemann(9348)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8310)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7772)
Grails in Action by Glen Smith Peter Ledbrook(7705)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7567)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7170)
Microservices with Go by Alexander Shuiskov(6941)
Practical Design Patterns for Java Developers by Miroslav Wengner(6855)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6801)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6424)
Angular Projects - Third Edition by Aristeidis Bampakos(6217)
The Art of Crafting User Stories by The Art of Crafting User Stories(5731)
NetSuite for Consultants - Second Edition by Peter Ries(5661)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5478)
Kotlin in Action by Dmitry Jemerov(5074)
