I fail to see any benefit in the structure of your data structure. If you have keys with names that contain consecutive intergers, then that is a big red flag saying you might need an array instead. Try this instead:

use Data::Dumper; my $customers = [ map { { current => [ $_ ] } } (13, 110, 10, 102, 108, 130, 10, 107, 5, 210, 1, 160, 16) ]; print Dumper $customers;
Now you have a simpler data structure that should provide the same functionality. If you need the value for key 'cust9' then you use index 8 instead:
print $customer->[8]->{current}->[0];
Sorting complex datastructures is always a little tricky, but we have a more simplified datastructure to work with now:
my @sorted = sort { $a->{current}->[0] <=> $b->{current}->[0] } @$customer; print Dumper \@sorted;
Be sure to use Data::Dumper often and liberally to observe what you datastructure really looks like, and use an array when you have consecutive indices.

UPDATE: yes, i read that. I really do wish that you would have stated that 'cust1' was just a bogus key name. However, i still stand by my recommendation, unless you are doing more lookups than sorts. Leaving out code is fine, but don't leave out the details, please. "The actual data structure is much larger than it appears below but the following code is sufficient to describe the issue" in no way implies that "The keys of the top level hash are our actual customer names which I did not feel should be listed in this forum."

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to Re: Help with Sorting by jeffa
in thread Help with Sorting by ChrisR

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.