Also note that it's not using the first line, but the second one. That's because you read the first one into $_ in the while loop condition, and the rest to @arr in the while loop body (so the loop only iterated once). Usually, you don't use several <...> operators on the same file handle.