in reply to Basic 'while' loop problem

Or, instead of using chomp, you can do:
s/[\r\n]+$//;