strict and warnings: Put them back NOW. Let Perl help you see (some of) your (other) mistakes.
while: The suggestion was that you pay attention to the difference between =, assignment and ==, equality test.
return: Since you didn't understand the above and you don't seem know where you're sending a return value, you probably should heed -- assiduously -- the suggestion "study a good book on fundamentals."