Jeanie has asked for the wisdom of the Perl Monks concerning the following question:

Please accept my sincerest apology if this is the wrong area to post my request. I purchased a classifieds software program which is written in Perl and would like to make some modifications. I am learning Perl, however slowly, and am having a hard time alphabetizing.I presently have this:
'21' => ['category','ascend', '9', '1', '1', '1', 'Category','on','on' +, '', 'string', '=', 'on', 'select', '', '', 'CERAMICS|SILVER|FURNITU +RE|SILVERPLATE|GLASS|TEXTILES|METALWARE|POST 1900|PEWTER|MISCELLANEOU +S|REPRODUCTIONS', 'on', 'bold', 'general', '80'],
To get this:

Listing Categories CERAMICS(3) SILVER (4) FURNITURE(8) SILVERPLATE(6) GLASS(12) TEXTILES (8) METALWARE(1) POST 1900 (0) PEWTER(0) POST 1900(0) REPRODUCTIONS(3) MISCELLANEOUS(5)

Everything APPEARS the way I want it to on the page, however, it appears out of alphabetical order in another segment of the program. When I put the Categories in strict alphabetical order and 2 pipe symbols (as per software tech), I get one column and an additional (0) for example:

CERAMICS (3) (0) FURNITURE (8) (0) GLASS (12) (0)
I would like everything to be in strict alphabetical order, no (0) and 2 columns. Can anyone help me? Thank you in advance for your assistance.

Replies are listed 'Best First'.
Re: Help with Alphabetizing - Array?
by adamsj (Hermit) on Jul 15, 2001 at 19:49 UTC
    Wow. I think you have a problem, and I'm not sure how much we can help.

    This statement:

    '21' => ['category','ascend', '9', '1', '1', '1', 'Category','on','on' +, '', 'string', '=', 'on', 'select', '', '', 'CERAMICS|SILVER|FURNITU +RE|SILVERPLATE|GLASS|TEXTILES|METALWARE|POST 1900|PEWTER|MISCELLANEOU +S|REPRODUCTIONS', 'on', 'bold', 'general', '80'],
    is fairly puzzling. It looks like a list is being assigned to an element of a hash, and that the list includes one element for your categories. But how that list affects the other parts of the program is, well, a good question. I'm going to suggest that you keep working with the tech, who should be familiar with this particular piece of software.

    I'd also suggest that one of the hardest ways to learn Perl (or any progamming language) is by taking apart someone else's work--at least, something as large and complex as I suspect this is. There are some good tutorials here, and one of our members has written a highly-regarded book on the subject--hey, I learned from it!

    Good luck!

    adamsj

    They laughed at Joan of Arc, but she went right ahead and built it. --Gracie Allen

Re: Help with Alphabetizing - Array?
by Anonymous Monk on Jul 15, 2001 at 19:44 UTC
    you may want to look at sort or this node. hope that helps.
Re: Help with Alphabetizing - Array?
by BMaximus (Chaplain) on Jul 16, 2001 at 03:56 UTC
    Hi Jeanie, It would help us a lot if you post your code as well for this problem. I'm somewhat getting what you would like but I'm having a hard time understanding it fully without it.

    BMaximus
Re: Help with Alphabetizing - Array?
by Jeanie (Initiate) on Jul 15, 2001 at 19:24 UTC
    Sorry, my lack of knowledge caused the Listing Categories displayed as 1 column instead of 2. It is 2 Columns.