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:
Hope this helps!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++; }
Edit: added alternative solution example, my original reply didn't add much ;-)
|
|---|
| 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 |