Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: xtracting unique lines

by Happy-the-monk (Abbot)
on Mar 27, 2012 at 18:22 UTC ( #961991=note: print w/ replies, xml ) Need Help??

in reply to xtracting unique lines

I'd split the pairs by the " + " string, sort {$a cmp $b} the pair into a temporary array. Use as hash key a string joined by the " + " string made of that array... and the original string as the hash value. When done print out all the values.

To shorten it, make the split, sort and join in one go and you get rid of the temporary array.

Cheers, Sören

Comment on Re: xtracting unique lines

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2015-11-28 16:47 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (743 votes), past polls