hi,

here is the deal. :

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" } }
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.

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.


In reply to windows linux and perl by baxy77bax

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.