in reply to Read from STDIN and stay on same line

You've seen how (relatively) long the code to read from the terminal without the newline is, and you've asked for how to do it without a special module, but why? Yes, even you can use CPAN...

Since I was just playing around with it the other day, here's a solution using IO::Prompter, nice and short - I've added the -num option so that it even validates the input for you and limits it to numbers.

use IO::Prompter; my $num = prompt("How much is A:", -num, -return=>" "); print "A=$num\n";