With a space between the "lines" instead of a carriage return, is Perl not getting each "line" from:
while ($line = <$input>) { }?
Never mind. When I look at the original input file that I'm using, those are carriage returns at the ends of the lines.