Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Generate list from a to arbitrary letter

by Eily (Vicar)
on Nov 20, 2013 at 23:20 UTC ( #1063629=note: print w/replies, xml ) Need Help??


in reply to [Solved] Generate list from a to arbitrary letter

Building a list from a list looks like a job for map. But unless order is really important, and it isn't just alphabetical order (using sort is easy enough), a list of pairs looks like something that could have its place in a hash. So, based on kennethk's answer (Edit: and similar AnomalousMonk's proposition):

$current = 'a'; my %cds = map { $_ => $current++ } @cd_names;
It shouldn't be much trouble to turn that into a array of arrays if needed :).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1063629]
help
Chatterbox?
[stevieb]: did my pull request challenge today, Locale::gettext. Weird layout for a dist, and I have no idea how to use it, but it's always nice when you can force someone else's work be use strict; and use warnings; compliant :)
[stevieb]: ahem... s/no idea how to use it/didn't read enough as to what it's used for/

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2017-01-24 01:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (199 votes). Check out past polls.