Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Sorting a hash value that is a list

by tangent (Vicar)
on Feb 26, 2012 at 23:45 UTC ( #956341=note: print w/replies, xml ) Need Help??

in reply to Sorting a hash value that is a list

[interesting username]
You could create a hash to keep track of your users like so:
my %seen = (); while(<FILE>) { chomp; ($host, $grp, $gid, $userid) = split(/:/, $_); $group = "$grp:$gid"; # check to see if we've seen this group/user already next if $seen{$group}{$userid}++; push @{$table{$group}}, $userid; } Prints: group1:9001:user1,user2,user3,user4,user5 group1:9006: group2:9002:user1,user2,user3 group3:9003:user1,user2,user4 group4:9004:user1,user2,user5 group5:9005:user1,user2 group6:9006: 7
Note that $seen{$group}{$userid}++ only increments after the check

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://956341]
[marto]: if your app just calls a remote or third party service to do the task, you app does not 'do the task', it's just a messenger
[marto]: in the sense that for various values of "a while ago" it would not have been possible (and arguable still isn't) to have a fingerprint of every piece of commercially released music to compare against.
[marto]: a co-worker refers to the late 1980s as "a while ago"
[Veltro]: Like I said before, I ment the solution as a whole
[Veltro]: People thought it was not possible.
[marto]: and until recently it wasn't and arguable (for some samples) probably isn't
[Veltro]: How did we get here? Oh yeah, advertisement. So let's get back there. What I ment to say is that I think it is possible to create an algorithm that filters out advertisement
[Veltro]: And yes, maybe your decoder needs the cloud to do so.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2018-05-24 12:12 GMT
Find Nodes?
    Voting Booth?