Use IO::Prompt
( my $_prompt = <<END_OF_PROMPT ) =~ s/^\s+?\|//gm; | You have encountered a Gru, what would you like to do? | Do you want to: | [1] Run away | [2] Fight | [3] Try to talk your way out of this | [4] Apply salt to your leg and let him eat you | [q] Quit | Please choose [ 1-4,Q ]: END_OF_PROMPT my $_response = prompt $_prompt, -one_char, -require => { "Must be one of 1-4 or 'Q'\n$_prompt" => qr/[1-4q]/smix };

In reply to Re: Binding keys to events? by HuckinFappy
in thread Binding keys to events? by tamaguchi

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.