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 =$
...
Preceding context expects a term, but found infix = instead.
Did you make a mistake in Pod syntax?
...
------> for =^$fh -> $line1, $line2 {
I had thought that something like this might work:
my $fh = open("file");
for $fh.lines,$fh.lines -> $line1,$line2 {
say $line1;
say $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':
for $fh.lines -> $line {
say $line;
}
works fine.
What is true is already so. Owning up to it doesn't make it worse. - Eugene Gendlin
|