I have some data that needs to be split up alphabetically into lists that start with each letter of the alphabet. Sample data is like the following with real URL data in place of URL1 and URL2. Only the first field is important for alphabetizing. If I do an array with each letter (and it can be assumed that it will always start with a capital letter), how can I do something like the following?

foreach $letter (@alphabet) {
  if firstchar of $data = $letter {
    push @{"$letter"}, $data
  }
}

sample data:

Psychology|URL1|URL2|
Notes and Queries|URL1|URL2|
ACM|URL1|URL2|
Biology|URL1|URL2|

Thanks,
Tim

--
Tim McGeary
[EMAIL PROTECTED]


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to