in reply to Reading two text files parallelly...
If you are trying to compare or match files on a line by line basis, this can become complex.#Maybe this what you mean???? open (F1, '<' ,$file1) or die "Cannot open file $file1 for reading\n"; open (F2, '<', $file2) or die "Cannot open file $file2 for reading\n";
What do you want to happen if say file1 has fewer lines than file2?
I didn't test this, but it appears that your "while statement" does:
So this simplifies into:while ( <F1>, <F2> ) { # throw away a line from file F1 - never to be used # end the loop if there are no more lines in F2 # set $_ to the next line from F2 # <F1> plays no role here - it is a No-Operation: NoOp }
Which I suspect is not what you want. What do you want?while ( <F2> ) { # $_ is a line from $file2 }
|
|---|