in reply to Re^2: Adding a numeric key to list items and creating a user selection list
in thread Adding a numeric key to list items and creating a user selection list

Cool! Besides the solution you were shown involving adding one to the index before you print it, you could also use unshift to pad the array and work with its true index:

my @vdbhosts = sort @lines; unshift @vdbhosts, 'padding'; my $count = 0; for ( @vdbhosts ) { my $host = $vdbhosts[ $count ]; print "$count: $host\n" unless $host eq 'padding'; $count++; }
Hope this helps!

Edit: added alternative solution example, my original reply didn't add much ;-)

The way forward always starts with a minimal test.
  • Comment on Re^3: Adding a numeric key to list items and creating a user selection list
  • Download Code

Replies are listed 'Best First'.
Re^4: Adding a numeric key to list items and creating a user selection list
by stevek1974 (Novice) on Sep 25, 2015 at 22:24 UTC

    Getting there. Actually working of the suggestion provided by hippo. Making progress. Thanks for your suggestion as well.