Skip to Content
Programming PERL in the .NET Environment
book

Programming PERL in the .NET Environment

by Yevgeny Menaker, Michael Saltzman, Robert J. Oberg
September 2002
Intermediate to advanced content levelIntermediate to advanced
496 pages
10h
English
Addison-Wesley Professional
Content preview from Programming PERL in the .NET Environment

Altering Control Flow

There are often programming situations where you need to perform a lookup within a data structure such as an array. You either find the item for which you conducted the search or you do not. Once you have found the item, you need to exit from the search loop. There are other situations where you also may need to alter control flow from within a loop.

last

The program below reads a list of hotels from a file. The user is then asked to enter the name of a hotel. The program loops through the list of hotels, trying to find the user's input among the hotels from the file. See the folder Hotels.

 % type hotels.pl # # hotels.pl # open(HOTELS, "hotels"); @hotels = <HOTELS>; while(1) { print "enter hotel name "; $hotel = <STDIN>; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Sams Teach Yourself Perl in 21 Days, Second Edition

Sams Teach Yourself Perl in 21 Days, Second Edition

Laura Lemay, Rafe Colburn
Pro Perl

Pro Perl

Peter Wainwright

Publisher Resources

ISBN: 0130652067Purchase book