in reply to Understading array of hashes

I think you are looking for a hash of arrays

DB<126> $array => [ { name => "Discount", reference => "100 ", type => "Paper" }, { name => "Documents", reference => "100 ", type => "Paper" }, { name => "Money", reference => "340 ", type => "Plastic" }, { name => "State", reference => "40 ", type => "Cotton" }, { name => "Slice", reference => "30 ", type => "Cotton" }, { name => "Part", reference => "45 ", type => "Cotton" }, ] DB<127> push @{ $hash{$_->{type}} }, $_->{name} for @$array; DB<128> \%hash => { Cotton => ["State", "Slice", "Part"], Paper => ["Discount", "Documents"], Plastic => ["Money"], }

update

DB<136> use YAML DB<137> print Dump \%hash --- Cotton: - State - Slice - Part Paper: - Discount - Documents Plastic: - Money

Cheers Rolf

( addicted to the Perl Programming Language)

PS: Starting with Perl 5.14, push can take a scalar EXPR, which must hold a reference to an unblessed array. ... i.a.W. you won't need the @{...} part.