in reply to Re: Reading two lines per loop iteration
in thread Reading two lines per loop iteration
I've been trying to do this in perl6, I can get your solution to work - perl6 may well have changed in the meantime.
In fact I get an error message about the =$I had thought that something like this might work:... Preceding context expects a term, but found infix = instead. Did you make a mistake in Pod syntax? ... ------> for =^$fh -> $line1, $line2 {
but this seems to produce a rather confusing result with all the lines stuck together is a Seq, and has some EOF related error, the 'singluar form':my $fh = open("file"); for $fh.lines,$fh.lines -> $line1,$line2 { say $line1; say $line2; }
for $fh.lines -> $line { say $line; }
works fine.
|
|---|