in reply to Read from STDIN and stay on same line

Hello pedrete,

you cant, without modules. Infact what can terminate your input if not a newline ( or a CTRL-Z on empty line )?

But with Term::ReadKey you can read a char at time:

use strict; use warnings; use Term::ReadKey; $|++; #you must autoflush buffer or it print only at newlines ReadMode('cbreak'); print "How much is A:"; my $input; my $char; while ( $char = ReadKey(0) and $char =~/^\d$/ ){ $input.=$char; print $char; } print " A=$input\n";

In the above code any non digit entered by the user will stop the while loop and you can print on the same line.

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.