use Term::ReadKey; my $prompt = "Gimme a char: "; while (1) { # updated to use the erase-to-EOL escape sequence print "\r$prompt\e[K"; my $key = ""; my $str = ""; ReadMode "cbreak"; do { print $key; $str .= $key; $key = ReadKey; } while $key ne "\n"; ReadMode "normal"; }