here's a thought... could you join all of the lines together (maybe chomp them all first), then you get one big line. then, you don't have to worry if the user's input spans into the second line or if they have new lines. this is assuming that a file contains only one 'line' of useful information though.
my $line = join '', map { chomp } <FILEPTR>;