Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Using the data structure, I need to remove duplicates using 'operation' and 'machine' keyword.
$data = [ { 'prod_order' => '702164', 'operation' => '10', 'machine' => 'W01', }, { 'prod_order' => '702164', 'operation' => '10', 'machine' => 'W02', }, { 'prod_order' => '702164', 'operation' => '10', 'machine' => 'W01', }, { 'prod_order' => '702164', 'operation' => '10', 'machine' => 'W02', }, { 'prod_order' => '702164', 'operation' => '10', 'machine' => 'W03', }, { 'prod_order' => '702164', 'operation' => '100', 'machine' => 'W03', } ];
Need to remove duplicates using 'operation' and 'machine' keyword. The ouput should be stored as follows
$data = [ { 'prod_order' => '702164', 'operation' => '10', 'machine' => 'W01', }, { 'prod_order' => '702164', 'operation' => '10', 'machine' => 'W02', }, { 'prod_order' => '702164', 'operation' => '10', 'machine' => 'W03', }, { 'prod_order' => '702164', 'operation' => '100', 'machine' => 'W03', } ];
Can anyone give me sample code?
Code tags added by GrandFather
2006-09-25 Retitled by GrandFather, as per Monastery guidelines
Original title: 'Need help'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help with removing duplicate hash keys from array of hashes
by jwkrahn (Abbot) on Sep 25, 2006 at 05:18 UTC | |
|
Re: Need help with removing duplicate hash keys from array of hashes
by chargrill (Parson) on Sep 25, 2006 at 04:41 UTC | |
|