I'm the author of Data::Sorting, and I can report that it doesn't really handle this situation well. (If you were sorting the arrays themselves, Data::Sorting would let you express it very concisely, but for sorting the keys by the values it's not so great.)

You can get something close to what you want, but as the other solutions here have shown, it may be easier to do the sorting yourself.

my $hashref = { 1 => [Frog, Fuzzy, A, other_stuff], 2 => [Frog, Fuzzy, '', other_stuff], 3 => [Toad, Zola, Q, other_stuff], 4 => [Frogger, Anthony, J, other_stuff], 5 => [Frog-Toad, Berl, G, other_stuff] }; use Data::Sorting 'sort_function'; my $sort_function = sort_function( map { my $x = $_; sub { $hashref->{ $_[0] }->[ $x ] } } 0, 1, 2); my @keys = $sort_function->( keys %$hashref ); print join ', ', @keys;

In reply to Re: Data::Sorting by simonm
in thread Data::Sorting by Fuzzy Frog

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.