in reply to While loop conditions in Perl

chomp $nextline before you compare it with anything.

So I am assuming conditions for while loops in perl are not behaving as one would normally expect.
That is assuming WAY TOO MUCH!