For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2007 > Re: Printing a backspace?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Printing a backspace?
Jeremy Kister

2007-07-22, 3:59 am

On 7/22/2007 12:42 AM, yitzle wrote:
> If I have a script that reads a password from <STDIN>. I want to not
> display the character in the terminal when its being typed.



You can do something like

print "passwd: ";
system "stty -echo";
chop(my $passwd=<STDIN> );
system "stty echo";
print "\n";

or use a module that does it for you..

use Term::ReadKey;

print "passwd: ";
ReadMode 2;
chop(my $passwd=<STDIN> );
ReadMode 0;
print "\n";

--

Jeremy Kister
http://jeremy.kister.net./
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com