Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^7: Get just the unique value

by hdb (Monsignor)
on Apr 05, 2013 at 19:34 UTC ( #1027206=note: print w/replies, xml ) Need Help??


in reply to Re^6: Get just the unique value
in thread Get just the unique value

How about this?

my %types; my $res; foreach my $entry (@$data) { push @$res, $entry unless $types{$entry->{"type"}}++; } print Dumper $res;

Replies are listed 'Best First'.
Re^8: Get just the unique value
by hdb (Monsignor) on Apr 05, 2013 at 19:43 UTC

    Or this without helper hash?

    my $res; foreach my $entry (@$data) { push @$res, $entry unless grep { $_->{"type"} eq $entry->{"type"} +} @$res; } print Dumper $res;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027206]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2017-12-17 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (462 votes). Check out past polls.

    Notices?