sub hex2str { shift =~ s/([a-fA-F0-9]{2})/pack("C", hex($1))/eg; } @x = sort { my $thea = hex2str($a->[0]); my $theb = hex2str($b->[0]); $thea cmp $theb; } @array;