in reply to Tallying co-occurence of numbers

If the order of the pair is not important, always store the lesser number first.
#!/usr/bin/perl use warnings; use strict; my %count; while (<>) { my @F1 = split /\t/; my @F2 = split /\t/, <>; my ($num, $from, $to) = (@F1[ 1, 2 ], $F2[2] ); ($from, $to) = ($to, $from) if $from > $to; ++$count{$num}{$from}{$to}; }

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Tallying co-occurence of numbers
by K_Edw (Beadle) on Jun 17, 2016 at 13:34 UTC
    I didn't think of that, thank you.