Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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


Comment on Re^2: counting pairwise incidences
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (16)
As of 2014-10-24 16:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (133 votes), past polls