#!/usr/bin/perl use strict; use warnings; use Tie::Hash::Sorted; my $sort = sub { my $h = shift; [ sort { $h->{$a}[0] cmp $h->{$b}[0] || $h->{$a}[1] cmp $h->{$b}[1] || $h->{$a}[2] cmp $h->{$b}[2] } keys %$h ]; }; tie my %s_hash, 'Tie::Hash::Sorted', 'Sort_Routine' => $sort, 'Optimization' => 'values'; %s_hash = ( 1 => [ qw(Frog Fuzzy A other_stuff) ], 2 => [ 'Frog', 'Fuzzy', '', 'other_stuff' ], 3 => [ qw(Toad Zola Q other_stuff) ], 4 => [ qw(Frogger Anthony J other_stuff) ], 5 => [ qw(Frog-Toad Berl G other_stuff) ], ); print "$_\n" for keys %s_hash;