I tried to think of a way to accomplish the first pass in the transform to make things simpler but failed.#!/usr/local/bin/perl -w # use strict; our @thingsToSort = ( {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'}, {author => 'lisa', title => 'eating veggies'}); our $firstAuthor = q(); foreach (@thingsToSort) { next unless $_->{title} eq 'THIS BOOK FIRST'; $firstAuthor = $_->{author}; last; } print map {"$_->[0]->{author}: $_->[0]->{title}\n"} sort { $b->[1] <=> $a->[1] || $b->[2] <=> $a->[2] || $a->[0]->{author} cmp $b->[0]->{author} || $a->[0]->{title} cmp $b->[0]->{title} } map { [ $_, $_->{title} eq 'THIS BOOK FIRST', $_->{author} eq $firstAuthor ] } @thingsToSort;
Cheers,
JohnGG
In reply to Re^2: Twisted sort requirements
by johngg
in thread Twisted sort requirements
by forrest
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |