http://www.perlmonks.org?node_id=1208941


in reply to Code Works But Not Sure How

1nickt: my @quoted = map { '$_' } @array; should be my @quoted = map { "'$_'" } @array; or my @quoted = map "'$_'", @array;.

RichHamilton, you have an off-by-one error here:

my $items = $#{$self->{menu_items}}; for (my $item = 0; $item < $items; $item++) ^^^

$#{$self->{menu_items}} is the index of the last element of the array @{$self->{menu_items}}, and you are traversing the array from zero to the element just before the last element, so the last element of the array will not be modified.