Sure, the end result is that $data only holds the unique values:
From this:
my $data = [
{
'type' => 'Paper'
},
{
'type' => 'Paper'
},
{
'type' => 'Plastic'
}, {
'type' => 'Plastic'
}, {
'type' => 'Plastic'
}, {
'type' => 'Plastic'
},
{
'type' => 'Cotton'
},
{
'type' => 'Cotton'
},
{
'type' => 'Cotton'
},
{
'type' => 'Cotton'
},
{
'type' => 'Cotton'
},
{
'type' => 'Paper'
},
{
'type' => 'Paper'
},
{
'type' => 'Paper'
},
{
'type' => 'Paper'
},
{
'type' => 'Paper'
},
];
To that:
$data = [
{
'type' => 'Paper'
},
{
'type' => 'Plastic'
},
{
'type' => 'Cotton'
},
];
|