in reply to [SOLVED] Checking username and password but cant break whileloop!
You need to change your logic such that the "does not match" message is printed AFTER the WHILE loop completes.
This means, you need a flag inside the while loop that determines whether or not a match was found.
Typically, this would be something like a $match_count, which initializes to zero, and is incremented on each match.
This counter could also be used to exit the loop early, if a match is found (using the 'last' verb).
At the end of the loop, if it is still zero, you print the message.
"By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest." -Confucius
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Checking username and password but cant break whileloop!
by jaffinito34 (Acolyte) on Nov 09, 2012 at 16:18 UTC |
In Section
Seekers of Perl Wisdom