#!/usr/bin/env perl
use warnings;
use 5.12.0;
use Term::UI;
use Term::ReadLine;
my $term = Term::ReadLine->new( 'brand' );
my @choices = ( qw( blue red green black white ) );
my $reply = $term->get_reply(
prompt => 'What is your favorite color?',
choices => \@choices,
default => 'blue',
);
say $reply;
Is there a module that allows me, to choose with the up- and down-keys:
I don’t have to write my choices like here but I can go with the up/down-key to the line with my favorite color and press “enter”.
If you want to display a menu in a terminal window, try Term::Clui. It displays a list of choices and lets the user select one or more with mouse or arrow keys.