Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 ( [id://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?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-16 21:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found