CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
deleting duplicates

 



Vincent Jansen
Deleted

Apr 17, 2000, 1:49 AM

Post #1 of 2 (613 views)
deleting duplicates Can't Post

Hi,

Can anyone tell me how to delete duplicate strings from an aray?


japhy
Enthusiast

Apr 17, 2000, 6:27 AM

Post #2 of 2 (613 views)
Re: deleting duplicates [In reply to] Can't Post

From Perl FAQ 4, How can I extract just the unique elements of an array?:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


undef %saw;
@out = grep(!$saw{$_}++, @in);
</pre><HR></BLOCKQUOTE>

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives