my %res = (); for my $entry (@$data) { $res{$entry->{type}} = 1; } print join(',', sort(keys(%res)))."\n";