in reply to Reading two lines per loop iteration

This sort of thing?

while ( my $line1 = <$fh> ) { my $line2 = <$fh>; # etc }

You'll need to check for eof on the second read though.

Replies are listed 'Best First'.
Re^2: Reading two lines per loop iteration
by blazar (Canon) on Jun 09, 2007 at 13:52 UTC

    This sort of thing?

    while ( my $line1 = <$fh> ) { my $line2 = <$fh>; # etc }

    Except that

    while ( my $line1 = <$fh> )

    is just the same as

    while ( defined(my $line1 = <$fh>) )

    so perhaps I would do:

    while ( my $line1 = <$fh> ) { defined(my $line2 = <$fh>) or last; # etc }