#!/usr/bin/perl use strict; use warnings; my @advocates = ( {fld_title => 'Rec1', fld_type => 'National'}, {fld_title => 'Rec2', fld_type => 'State' }, {fld_title => 'Rec3', fld_type => 'Local' } ); my %order = (LOCAL => 'A', STATE => 'B', NATIONAL => 'C'); my @sorted = sort { $order{uc $a->{fld_type}} cmp $order{uc $b->{fld_type}} || $a->{fld_title} cmp $b->{fld_title} } @advocates; print "$_->{fld_title}\n" for @sorted;