#I made this change first... - 1 while(readline($data[$i]->{FH})); + while(readline($data[$i]->{FH})){ + 1; + };