secret
Last active

  • Download Gist
tests.pl
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/usr/bin/env perl
#
use Term::ANSIMenu;
use strict;
use warnings;
 
my @menu_items = ();
my @tmp = ();
my $counter = 1;
my @available_choices =
('menu choice one', 'menu choice two', 'menu choice three');
 
sub handle_menu_item {
print "Handling menu item\n"
}
 
foreach my $item (@available_choices) {
@tmp = ($counter, $item, \&handle_menu_item);
push @menu_items, [@tmp];
$counter++;
}
 
my $menu = Term::ANSIMenu->new(
width => 40,
title => 'Choose your fate or die!',
items => \@menu_items,
prompt => 'Selection:> '
);
 
$menu->print_menu();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.