Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Most elegant way to dispose of duplicates using map

by borisz (Canon)
on Oct 30, 2006 at 16:30 UTC ( #581333=note: print w/replies, xml ) Need Help??

in reply to Most elegant way to dispose of duplicates using map

Hope this is what you have in mind.
sub extractPartTuplesFromURL { my $cgi = shift; my @partTuples = $cgi->param('partID'); my %dupes; @partTuples = map { my @t = split(','); $dupes{ $t[0] }++ ? () : +{ id => $t[0], version => $t[1], classification => $t[2] } } @partTuples; return \@partTuples; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://581333]
[thao4]: thao4
[hippo]: Indeed you are.
[thao4]: Hi all, I am new in perl. I need do somthing in perl: exemple: - search a patern "CADRE 1.1 CPU" in one file.txt - incremente +30 lines from the line with the patern found - replace the patern "Model Regle" by "Heath Rule A" in this new line (30 line
[marto]: good morning all
[hippo]: Welcome. Tell me, have you read perlintro? That's a great place to start.
[thao4]: I seach to do that since a week but I can't found the answer in google. Thank for your help

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2018-02-21 09:42 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (276 votes). Check out past polls.