On Sun, Feb 06, 2005 at 10:33:05PM +0800 Xiaofang Zhou wrote: > Anyone can help me in this?. When running > > $password = <STDIN>; > > the password will show on the console windows as user > type in. Is it possible for perl to read from keyboard > directly, without echo to the console window?
there is a part off the program swen, which can help you: my $password = $params{p}; unless (defined $password) { my $trk_loaded = 0; # "use" loads modules at compile-time. Since Term::ReadKey is used # if it is installed, but there's no problem if not, we "require" # instead and import their symbols by hand if successful. # # See perldoc -f require and perldoc -q require for further details. eval { require Term::ReadKey; import Term::ReadKey; $trk_loaded = 1; }; print 'Password: '; ReadMode('noecho') if $trk_loaded; # input echo off chomp($password = $trk_loaded ? ReadLine(0) : <STDIN>); ReadMode('restore') if $trk_loaded; # input echo on print "\n"; } Author: Xavier Noria hth -- Gérard -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>