- print can take a list. perhaps the problem is in the loop? unlikely. it's probably in the assignment somewere
- print the lines as you read them, instead of many at a time. If this works and the prior solution doesn't i suspect something has gone wrong in you assignment to @lines.
This is very odd behavior indeed. The code works perfectly on my machine, and there is nothing in it to go wrong. Perhaps something is wrong with your terminal?