in reply to Code Works But Not Sure How
If you are numbering your menu items upwards from '1' this might be a simpler way to initialise your options.
use strict; use warnings; use feature qw{ say }; my @options = ( q{Option 1}, q{Option 2}, q{Option 3}, q{Option 4}, ); my $ct; @options = map { ++ $ct; qq{'$ct'}, qq{'$_'} } @options; say for @options;
The output.
'1' 'Option 1' '2' 'Option 2' '3' 'Option 3' '4' 'Option 4'
I hope this is of interest.
Cheers,
JohnGG
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Code Works But Not Sure How
by RichHamilton (Novice) on Feb 11, 2018 at 14:15 UTC |
In Section
Seekers of Perl Wisdom