#!/usr/local/bin/perl -w use strict; my $data = ( [ { num => 'OF1234', title => 'title OF1234', }, { num => 'AF1234', title => 'title AF1234', }, { num => 'AF1234', title => 'title AF1234', }, ] ); #print @{$data}; my @sorted = # now get the original array ref back map { $_->[0] } # use field 1 of anonymous array to sort (in this # case num) sort { $a->[1] cmp $b->[1] } # make an anonymous array of itself and num map { [$_, $_->{num}] } # start with the array ref and make it an array @{$data}; print join ', ', map { $_->{num} } @sorted; print "\n"; my %saw; undef %saw; my @unique = grep !$saw{$_->{num}}++, @sorted; print join ', ', map { $_->{num} } @unique; print "\n"; exit; #### AF1234, AF1234, OF1234 AF1234, OF1234 #### my @keys = sort keys %{ { map { $_ => 1 } @array1 } };