pedrete has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks...
i would like to read-from-STDIN normally and remain on the same line so the next 'print' will be in the same line as the read-from-STDIN
I have the next code:
print "How much is A:"; my $a=<STDIN>; chomp $a; print " A=$a";
that produces an output like this (assuming i type the number 25):
How much is A:25 A=25
but i want a result like:
How can i do that? is it possible without any especial module? Thanks...How much is A:25 A=25
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read from STDIN and stay on same line
by Discipulus (Canon) on Dec 26, 2018 at 15:34 UTC | |
|
Re: Read from STDIN and stay on same line
by kschwab (Vicar) on Dec 26, 2018 at 15:51 UTC | |
|
Re: Read from STDIN and stay on same line
by johngg (Canon) on Dec 26, 2018 at 15:39 UTC | |
|
Re: Read from STDIN and stay on same line
by haukex (Archbishop) on Dec 27, 2018 at 08:10 UTC | |
|
Re: Read from STDIN and stay on same line
by Anonymous Monk on Dec 26, 2018 at 15:39 UTC | |
|
Re: Read from STDIN and stay on same line
by pedrete (Sexton) on Dec 26, 2018 at 16:20 UTC |