Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: removing duplicated elements from array, with a difference

by dpuu (Chaplain)
on Aug 28, 2002 at 18:11 UTC ( [id://193526]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      my %item_count;
      %item_count{$_}++ foreach (@array);
    
  2. or download this
      @result = grep {$item_count{$_} == 1} @array;
    
  3. or download this
      my %item_count;
      %item_count{$_}++ for grep {/pattern/} @array
      @result = grep {$item_count{$_} <= 1} @array;
    
  4. or download this
      @result = grep {($item_count{$_}||0) <= 1} @array;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-20 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found