in reply to compare columns in all possible combination

You're putting a while loop to read a file inside of a for loop that reads another file. However, you've not told perl to restart the file at the beginning just before your while loop. So the first time through your for loop, you read one line of the first file and the entire second file. At the next iteration of your for loop, you read the second line of the first file, and *nothing* from the second file because you've already read it all.

The simplest (and least efficient) fix would be to close the second file after your while loop, and open it just before the while loop.

A better fix would be to read the second file into an array first, and then in your for loop you can simply loop over the array containing the second file.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: compare columns in all possible combination