in reply to Read from STDIN and stay on same line

You would have to set terminal attributes: enable non-canonical mode to get each character (not line) that the user is typing, disable echo so that the entered newline won't be automatically printed back; read characters in a loop until you get the newline. See POSIX::Termios on how to do that in Perl on a POSIX-compliant system and perhaps look in Win32::Console for a similar thing on Windows.

Search CPAN for keyword "propmt" to see if someone else has already implemented this functionality.

  • Comment on Re: Read from STDIN and stay on same line