in reply to Re: filter array based on 2 fields
in thread filter array based on 2 fields
More simply - and keeping the order:
@arr = ('c1,s1,d1','c2,s2,d2','c1,s1,d2','c1,s2,d3'); @arr = grep{ /(.+),/; !$seen{$1}++ } @arr; print join$/,@arr;
Prints:
c1,s1,d1 c2,s2,d2 c1,s2,d3
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: filter array based on 2 fields
by Anonymous Monk on Aug 20, 2012 at 17:40 UTC | |
by Anonymous Monk on Aug 20, 2012 at 17:43 UTC |
In Section
Seekers of Perl Wisdom