At 11:35 AM 8/9/01 -0500, Frank Newland wrote:
>Readers:
>awk has a function called 'getline' which reads the next line of input
>without changing control of the script.
>
>My input file contains pairs of records. When I find a record that matches
>my search pattern, I want that record and the next record.
>In awk, I used the 'getline' which did just that.
>
>How can I do this in perl?
>Does using the $* variable get me there?
>--------------------------------------------------
>#!/usr/bin/perl -w
>use strict ;
>## If the record ends in 03 then capture this record and the next one.
>while (<>) {
>chomp ;
>
>if ( /03$/) {
>print ; #print this record, now how do I capture just the next record?
>}
>------------------------------------------------------------
Something like
my $nextline = <ARGV>;
at that point should get it for you. (Inside the loop reading from <> the
current filehandle is ARGV.)
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]