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

Answer: How do I make password prompts not echo back the user?

by Fastolfe (Vicar)
on Sep 20, 2000 at 21:31 UTC ( #33360=categorized answer: print w/replies, xml ) Need Help??

Q&A > input and output > How do I make password prompts not echo back the user? - Answer contributed by Fastolfe

The easiest solution, under Unix at least, is to call 'stty' to change the terminal's "echo" attribute. I know of no way to do this under Windows or any non-Unix platform, and there may be a more standardized way of doing this (such as via curses or some Term-based module):
print "login: " my $login = <>; print "Password: " system('/usr/bin/stty', '-echo'); # Disable echoing my $password = <>; system('/usr/bin/stty', 'echo'); # Turn it back on

Log In?

What's my password?
Create A New User
marto waves
[Corion]: Hi marto, Discipulus, choroba!
[Corion]: Seems like I chose just the right day to do a half-day recovery yesterday. Today it's snowing again, instead of the sun shining, so that's a good day to be at the office again ;)
[Discipulus]: good morning folks!

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2018-03-22 09:13 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (273 votes). Check out past polls.