Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Tallying co-occurence of numbers

by choroba (Cardinal)
on Jun 17, 2016 at 13:32 UTC ( [id://1165973]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found