On Thu, 04 Aug 2005 09:38:15 +0800, Michael Beattie <[EMAIL PROTECTED]> wrote:

On 8/3/05, Wouter van Rooij <[EMAIL PROTECTED]> wrote:
\

Hello,

At the first place, sorry for my bad English.
My question is:
How can you, when you're writing a perl program, make a input
(<stdin>) hidden, so that when someone is typing an input in the
following program is hidden:
#!/usr/bin/perl
print "Your name:";
$name = <STDIN>
I would like to get the input like this: ********

The PERL Cookbook seems to have the answer.

Problem

You want to read input from the keyboard without the keystrokes being echoed on the screen. For instance, you want to read passwords as passwd does, i.e. without displaying the user's password.
Solution

Use the CPAN module Term::ReadKey, set the input mode to noecho, and then use ReadLine:

use Term::ReadKey;

ReadMode('noecho');
$password = ReadLine(0);
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to