Let me rephrase, you are not reading from the correct file. You need to change your $Line assignments from

Code:

$Line = split(readline(1),"; ")


to
Code:

$Line = split(readline(2),"; ")



Right now, you're trying to read from the file you are writing to.
_________________________
Eric