You are going to need a pre-pass of the data to find the author of the titled book. I've lower cased the titles for the sort so that "the book of ... " and "The book of..." will sort together, but that is easily removed. This assumes that your authors names and book titles don't contain null chars.

#! perl -slw use strict; my @things_to_sort = ( { author => 'bart', title => 'skateboarding' }, { author => 'lisa', title => 'postmodernism' }, { author => 'marge', title => 'hairstyles' }, { author => 'lisa', title => 'THIS BOOK FIRST' }, { author => 'homer', title => 'donuts' }, { author => 'bart', title => 'coolness' } ); my $firstTitle = 'THIS BOOK FIRST'; ## Find the author of the title my $firstAuthor; $_->{ title } eq $firstTitle and $firstAuthor = $_->{ author } for @things_to_sort; die "Title $firstTitle not found" unless $firstAuthor; my @sorted = map{ $_->[0] } sort { $a->[ 1 ] cmp $b->[ 1 ] } map { [ $_, sprintf "%s%s%s\0%s\0", $_->{ title } eq $firstTitle ? chr(0) : '', $_->{ author } eq $firstAuthor ? chr(0) : '', lc( $_->{ author } ), lc( $_->{ title } ) ] } @things_to_sort; printf "%-8s %-20s %-6s %-10s\n", %$_ for @sorted; __END__ c:\Perl\test>junk title THIS BOOK FIRST author lisa title postmodernism author lisa title coolness author bart title skateboarding author bart title donuts author homer title hairstyles author marge

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Twisted sort requirements by BrowserUk
in thread Twisted sort requirements by forrest

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.