Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!csus.edu!beach.csulb.edu!jbryans From: jbryans@beach.csulb.edu (Jack Bryans) Newsgroups: comp.lang.perl Subject: Re: Easy way to peek ahead in <> Message-ID: Date: 29 May 91 21:11:33 GMT References: <1991May29.004259.11825@dartvax.dartmouth.edu> Sender: news@beach.csulb.edu (News Administration/Rumor Bureau) Organization: Cal State Long Beach Lines: 24 In-Reply-To: xerox@eleazar.dartmouth.edu's message of 29 May 91 00:42:59 GMT In article <1991May29.004259.11825@dartvax.dartmouth.edu> xerox@eleazar.dartmouth.edu (Jamie Osborne) writes: > Is there any easy way to peek ahead using the while(<>) { > construct? I want to be able to read the next line, but I don't want > to advance <> yet. Try: loop: while(<>) { . . . if ( next-line-peek-stuff ) { whatchya-wanna-do-if next; } redo loop; } The "redo"'ll start you over w/the "peek'ed at" line as the "next" line. Jack