@sorted = sort { $a->{title} eq "THIS BOOK FIRST" && -1 or $b->{title} eq "THIS BOOK FIRST" && 1 or ( $a->{author} eq $author and $b->{author} eq $author ) && $a->{title} cmp $b->{title} or $a->{author} eq $author && -1 or $b->{author} eq $author && 1 or $a->{author} cmp $b->{author} or $a->{title} cmp $b->{title} } @things_to_sort;