Unix side of things:

Welcome, you just found a nest of killer-bees in your way:)

Very Short Version:

There are no arrow keys (sensu key code in terminal windows). Use cat -vet to know what sequence to expect for a key.

Moderately Short Version:

On a Unix box, check man termcap, terminfo, maybe also stty, tput, setterm, and possibly curses (there are a number of perl modules as well, incl. for curses use; but I think you should stop well before curses unless you really need it). Termcap and terminfo make sense of the TERM variable (often one of xterm or vt100) and translate that to the actual capabilities to expect from the terminal (/pty/tty; if not avoidable: read up on the master/slave side of ptys as well; also raw, cooked, cbreak; the notions of process groups and controlling ttys).

This page from the docs of the rxvt-unicode X graphical terminal emulator http://pwet.fr/man/linux/conventions/urxvt might serve to give you some impression of terminal apps and the (historical) esc-codes controllig their use, going back all the way to the use of the earliest typewriters as terminals on mini computers (and most of that cruft is still retained).

Which keys to expect: how about cat -vet in a shell window. Note that for X, there was a change, so rxvt (and vt100/screen I think?) tend to use the older style, xterm provides the newer cursor/function key codes


In reply to Re: Capturing Arrow Keys Input by jakobi
in thread Capturing Arrow Keys Input by Anonymous Monk

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.