Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Duplicated data in array. (updated)

by AnomalousMonk (Archbishop)
on Nov 02, 2021 at 20:27 UTC ( [id://11138350]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Duplicated data in array.
in thread Duplicated data in array.

Untested:

my %seen1; my @out1 = grep { ! $seen1{ $_->{ID} }++ } @in; my $arrayref = \@out1; pp $arrayref;

Update: Perhaps a bit late for this afterthought, but the general form of this question is "How do I create a reference to X?" Please see perlref and perlreftut. See also Perl Data Structures Cookbook (perldsc) for dealing with complicated referential structures.


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11138350]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found