baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
here is the deal. :
the output of the script isn't the focus here, but the way, is what interests me. so when you run the script it asks you to type something , then you type it in then it asks you to confirm the thing you typed (yea or ney), and here is the question.use strict; my $r; until($r =~ /yea/i){ print "type in something:\n"; chomp(my $i = <>); print "you typed $i , is this correct? [yea or ney]\n"; chomp($r = <>); if ($r =~ /yea/i){ print "yuuuuuupiiiiiiiii !!\n"; } else { print "dough !!!\n" } }
on ms-dos if you hit the up arrow key it displays the thing you typed in second ago, when it asks you to type in something, and on the linux machine when you do the same thing you get
^[[A^[[A^[[A^[[A^[[B^[[B
i suppose you understand what this is (up,up,up,up,down,down). this is very unpractical if you are running some interactive cmd prompt application, because if you did something wrong on the first character then you have to delete all the characters from the end of the command, to that first letter to correct it .
so is there a way to make this script run as on the windows machine, so it is possible to go up down right and left, but just in that aspect.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: windows linux and perl
by kyle (Abbot) on Dec 09, 2008 at 19:29 UTC | |
|
Re: windows linux and perl
by oko1 (Deacon) on Dec 09, 2008 at 20:29 UTC | |
|
Re: windows linux and perl
by kennethk (Abbot) on Dec 09, 2008 at 19:26 UTC |