Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: No <STDIN> yeilds username and password

by Cody Pendant (Prior)
on Feb 09, 2008 at 05:07 UTC ( #667137=note: print w/replies, xml ) Need Help??


in reply to No <STDIN> yeilds username and password

Not that there's anything wrong with the above answers, but surely the reason for the specific problem:
if you enter nothing and hit enter it yields the username and password you have entered previously
Is that if you do that, you're doing the regex with an empty string. Which matches.

You're essentially doing if ($key =~ m//i) if they just hit return.

So you need another if clause as well as the one for "if it's 'exit'" which says what to do if it's empty.



Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...

Replies are listed 'Best First'.
Re^2: No <STDIN> yeilds username and password
by trenchwar (Beadle) on Feb 09, 2008 at 05:37 UTC
    Hey Cody....your exactly right.... I am trying to figure out the clause that will loops it back to the beginning of the while statement if it is empty.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2020-07-06 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?