#!/perl/bin/perl use Term::ReadKey; while(1){ ReadMode 3; #cbreak mode &menu; print "\tChoice: "; my $key = ReadKey(); print "$key"; &hello_world if $key == 1; &get_password if $key == 2; if( $key eq 'q' || $key eq 'Q'){ print "\nExiting"; exit(0); } } sub get_password{ binmode STDIN, ":raw"; ReadMode 3; my ($key, $val, $pass, $backstop); my @password; my $prompt = "\n\n\tPassword: "; system("cls"); # NOTE if you make a call to the system you have to reset the ReadMode :) #After we make the system call... ReadMode is set back to normal or 0!! ReadMode 3; print "$prompt"; while($key = ReadKey()){ $val = ord $key; push @password, $key unless $val == 8 || $val == 13; $backstop = @password; last if $val == 13; if($val == 8){ pop @password; if($backstop) {print "\b \b"; } } print "*" unless $val == 8; } ReadMode 0; binmode STDIN, ":crlf"; foreach(@password) { $pass .= $_; } print "\n\n\tYou entered: $pass\n\t(will return to main menu in 3 ticks)"; sleep 3; system("cls"); } sub menu{ print <