Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^2: counting pairwise incidences

by ikegami (Pope)
on May 17, 2011 at 17:26 UTC ( #905319=note: print w/replies, xml ) Need Help??

in reply to Re: counting pairwise incidences
in thread counting pairwise incidences

Looks like ab ac ad to me, in which case it simplifies to:
use strict; use warnings; my %pairs; while (<DATA>) { my ($first, @names) = split; for my $second (@names) { my $p = join '_', $first, $second; ++$pairs{$p}; } } while (my ($k, $v) = each %pairs) { print "$k: $v\n"; } __DATA__ tomD gly4 phil aesG tomD gly4 phil aesG phil aesG tomD gly4

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (13)
As of 2016-10-24 17:24 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (309 votes). Check out past polls.