Thanks for the feedback and ideas, but I couldn't get any of these ideas to work for me.  They do work if all I wanted to do is sort a hash by values.  But trying to drop such a sorted hash into the CGI directive, scrolling_list() seems to be too much for the module--it either fails or it still sorts according to key or it doesn't sort at all.

Anyway, I've worked around it. The content of my values already read, "$client_name - $clientid" with the key reading, "$clientid."  So I changed my scrolling_list to read simply like this:

print $q->scrolling_list(-name=>'acct_num', -values=> [sort values %clients] );

This gives me the alphabetical sort based on the client names (e.g., values) that I need.  It does make the HTML option select value the same as the label (e.g., client name - client id)--granted, very messy.  But I put the following line in the next CGI script that parses out the data entered in the first script:

$acct_num = (split/ \- /, $acct_num)[-1];

This has solved my immediate problem.  However, if anyone can contribute more comments to my original question, I would glad to have them for my education and for those who might read this posting in the future.  Thanks.


In reply to Re: More Sorted Business with Hashes by Spenser
in thread More Sorted Business with Hashes by Spenser

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.