use warnings; use Win32::Console; sub readPasswordWindows { my $pwdText = shift; my $inputValue = ""; my $StdIn = Win32::Console->new(STD_INPUT_HANDLE); my $orig_mode = $StdIn->Mode(); $StdIn->Mode(ENABLE_PROCESSED_INPUT); my $Password = promptPassword($StdIn, $pwdText, '*'); print "\nPassword = $Password\n"; $StdIn->Mode($orig_mode); return $Password; } sub promptPassword { my ($handle, $prompt, $mask) = @_; my ($Password); local $| = 1; print $prompt; $handle->Flush; while (my $Data = $handle->InputChar(1)) { last if "\r" eq $Data; if ("\ch" eq $Data ) { if ( "" ne chop( $Password )) { print "\ch \ch"; } next; } $Password .= $Data; print $mask; } return $Password; } sub readInput(){ my $ip =""; print " \n Input : "; $ip = ; print "\n input was = $ip"; return; } my $pw = readPasswordWindows("Enter password: "); readInput();