in reply to How to 'peek' at next line while parsing with <>
yeilds:#!/usr/bin/perl use strict; use warnings; { $_ = <DATA>; my $next_line; while( $next_line = <DATA> ) { print "current line: $_ -- next line: $next_line$/"; } continue { $_ = $next_line; } } __DATA__ 1 2 3 4 5
note: the last line is not processed.current line: 1 -- next line: 2 current line: 2 -- next line: 3 current line: 3 -- next line: 4 current line: 4 -- next line: 5
~Particle *accelerates*
|
|---|