Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Checking username and password but cant break whileloop!

by NetWallah (Abbot)
on Nov 09, 2012 at 16:11 UTC ( #1003177=note: print w/ replies, xml ) Need Help??


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


Comment on Re: Checking username and password but cant break whileloop!
Re^2: Checking username and password but cant break whileloop!
by jaffinito34 (Acolyte) on Nov 09, 2012 at 16:18 UTC

    Genius

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003177]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2014-09-19 09:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls