in reply to Re^2: Code Works But Not Sure How
in thread Code Works But Not Sure How

The items have their own associated array index so I don't see you really need to store sequential numbers as well

#!/usr/bin/perl package MyClass; use strict; use warnings; sub new { my $class = shift; my $self = { menu_items => _quote_items(shift), }; bless $self,$class; } sub _quote_items { my $ar = shift; $_ = "'$_'" for @$ar; return $ar; } package main; use strict; use warnings; use Data::Dumper; my @array = ('Option 0','Option 1','Option 2','Option 3','Option 4'); my $obj = MyClass->new(\@array); print Dumper $obj;
poj

Replies are listed 'Best First'.
Re^4: Code Works But Not Sure How
by RichHamilton (Novice) on Feb 11, 2018 at 13:45 UTC
    You're right poj. In the code I use to create the menubox include the index as the menu items are a flattened array. I'm using a Linux Gazette bash script example and converting it over to perl. Basically its my own version of UI::Dialog.