Skip to content

Instantly share code, notes, and snippets.

@yko

yko/tests.pl Secret

Created November 7, 2011 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yko/4ea508b0e8e865ab1fdd to your computer and use it in GitHub Desktop.
Save yko/4ea508b0e8e865ab1fdd to your computer and use it in GitHub Desktop.
#!/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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment