Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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

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 surveying the Monastery: (4)
As of 2016-10-22 02:14 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (291 votes). Check out past polls.