in reply to Problems with Term::ReadKey

I had to Ctrl-J also. You need a way to get out if necessary. What if the user had second thoughts about putting his password out there, and wanted to quit?
exit 0 if $key eq 'q';
Here's what I tried:
#!/usr/bin/perl -slw use strict; use Term::ReadKey; my $key = 0; my $password = ""; print "\nPlease input your password: "; ReadMode(4); while(ord($key = ReadKey(0)) != 10) { exit 0 if $key eq 'q'; if(ord($key) == 127 or ord($key) == 8) { chop($password); print "\b \b"; } elsif(ord($key) < 32) { (); } else { $password = $password . $key; print ord($key); } } ReadMode(0); print "\n\nYour super secret password is: $password";
Update: If 'q' is a problem for you, substitute a fake password like 'quit', 'exit', 'bye', etc. for 'q';