Hacker News new | ask | show | jobs
by TheDong 3736 days ago
You're thinking of 'puts' which appends a newline.

'print' does not

The code does handle/preserve all the cases you mentioned (\r\n, final or no final terminating newline, etc).