One problem I see is that you read a character, reprint the prompt containing the value $word and then update the value of $word only after the print. Thus we only see the updated output after another charater is printed. This behavior obfuscates what is going one with your code and you should fix this first.

From man getc() on my system.

... The end-of-file con-
     dition is remembered, even on a terminal, and all subsequent attempts to
     read will return EOF until the condition is cleared with clearerr(3).
I'm not sure how this applies to Term::ReadKey but generally applies to any system built on top of getc().

You may want to locallize autoflush. Like this:

... { local $|=1; print "something" } ...

Otherwise your threads and your shell user will inherit print with autoflush turned on.

Please if you could remove commented "old code" before posting here it would make reading your code easier.


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

In reply to Re: Term::ReadKey problem #2! by starbolin
in thread Term::ReadKey problem #2! by Ace128

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.