Trying to use Term::ANSIMenu to build a nice menu.
The doc says items() expects an array of arrays:
items()
Type: array of arrays
Constraints: [[<keyname>, <string>, <code_ref>], ...]
Default: []
So this works fine:
my $menu = Term::ANSIMenu->new(
items => [['1', 'First menu item', \&exec_item],
['2', 'And so on', \&exec_item],
]) ;
What I need to do is feed items() with strings in an existing array (that gets dynamically created by my program – it may contain any number of strings).
e.g.
@array = ('menu choice one', 'menu choice two', 'menu choice three') ;
I’m struggling to create an “array of arrays” that I can then pass to items().
Any takers?
You need to pass reference to array
Should looks like: