Re: peek next line in file
On Sep 27, 2007, at 1:29 AM, Mahurshi Akilla wrote: Is there a way in perl to peek the next line in the file while keeping the line pointer the same? I want to do something like this: while () { //do some stuff //?? peek next line ?? and enter conditional block// //do some more stuff } You could do this: my $pos = tell $fh; my $next_line = <$fh>; seek $fh, $pos, 0; -- fxn -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
peek next line in file
Is there a way in perl to peek the next line in the file while keeping the line pointer the same? I want to do something like this: while () { //do some stuff //?? peek next line ?? and enter conditional block// //do some more stuff } Of course, there are workarounds, but it would be nice to know if this can be done. Mahurshi Akilla -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/