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: Intermediate: Re: [soeeom] help with obtimizing: Edit Log



BillKSmith
Veteran

Jul 4, 2011, 8:47 PM


Views: 893
Re: [soeeom] help with obtimizing

I am not sure what you mean by 'weed out replicas'. When a word is replicated in the original, do you want to remove all copies of it or all but one. Assuming the later, use the uniq function in the module List::MoreUtils.

untested.


Code
   

use List::MoreUtils qw (uniq);

@text = uniq grep {/^@/} @words;





This solution assumes one word perl element of @words. Your code suggests that this is not true. Use your code. Filter your results with uniq on a separate line.
Good Luck,
Bill

(This post was edited by BillKSmith on Jul 5, 2011, 4:56 AM)


Edit Log:
Post edited by BillKSmith (Veteran) on Jul 5, 2011, 4:56 AM


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

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