in reply to Blank File

Oh yes,
One more thing. When I had the print statements in this order:
print THIRD "$_->[0]|$key|$cols[0]"; print THIRD $_->[0].$id; print THIRD "\n";

the code worked flawlessly.
I hope this helps somewhat.

Thanks
Dipul