#!/usr/bin/perl use strict; use Data::Dumper; my @advocates = ( { fld_title => 'Rec1', fld_type => 'National', }, { fld_title => 'Rec2', fld_type => 'State', }, { fld_title => 'Rec3', fld_type => 'Local', }, ); my $order = "\0local\0state\0national\0"; sub by_locale { index( $order, "\0" . lc( $a->{ fld_type } ) . "\0" ) <=> index( $order, "\0" . lc( $b->{ fld_type } ) . "\0" ) } my @sorted_advocates = sort by_locale @advocates; warn Dumper("unsorted_advocates", \@advocates); warn Dumper("sorted_advocates", \@sorted_advocates);