-
-
Save yko/4ea508b0e8e865ab1fdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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