use warnings; use Data::Dumper; 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 $author = ''; my @sort = map { $_->[0] } sort { $b->[1] <=> $a->[1] || $a->[0]->{author} cmp $b->[0]->{author} || $a->[0]->{title} cmp $b->[0]->{title} } map { [ $_->[0], $_->[0]->{author} eq $author ? $_->[1] + 2 : $_->[1] ] } map { [ $_, $_->{title} eq 'THIS BOOK FIRST' ? ($author = $_->{author}) && 4 : 0 ] } @things_to_sort; print Dumper \@sort