Mar 6, 2013, 10:01 AM
Post #2 of 3
The word break is a keyword in C, but not in perl. There is no exact equivalent, but in this case, you can use last.
Re: [ticketE] exit condition while
[In reply to]
Although your code will work with just this change, it does have several issues. You should always use use strict; and use warnings;. Strict will require you declare your variables (use my)
Your second test for the equal character is not needed. When it is true, you will never get there.
You should prompt for input. Your user has no indication that nothing is happening because you are waiting for input from him. There are good reasons to use a prompt module from CPAN rather than printing your own prompts.
Read about the range operator in perdoc perlop. You should be able to simplify your logic.