in reply to Adding a numeric key to list items and creating a user selection list
Use a counter:
Also, don't use File::Slurp -- it's broken. Use File::Slurper or Path::Tiny instead.my @vdbhosts = sort @lines; my $count = 1; for ( @vdbhosts ) { print "$count: $vdbhosts[ $count ]\n"; $count++; }
Hope this helps!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Adding a numeric key to list items and creating a user selection list
by stevek1974 (Novice) on Sep 25, 2015 at 18:38 UTC | |
by 1nickt (Canon) on Sep 25, 2015 at 20:40 UTC | |
by stevek1974 (Novice) on Sep 25, 2015 at 22:24 UTC | |
by Anonymous Monk on Sep 25, 2015 at 22:55 UTC |