Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^6: Unique array w/o repeated elements and still keep the original order!

by jynx (Priest)
on Aug 09, 2002 at 21:17 UTC ( #189051=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %seen;
    my @unique = grep {not $seen{$_}++} <FILE>;
    chomp @unique;
    
  2. or download this
    my (%seen, @unique);
    chomp( @unique = grep {not $seen{$_}++} <FILE> );
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2023-09-28 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?