aboutsummaryrefslogtreecommitdiffstats
path: root/pairwise.pl
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2024-01-26 13:07:01 -0500
committerBrian Cully <bjc@spork.org>2024-01-26 13:07:01 -0500
commit6817184113c38dc394f44681e956e5f7bb9bf2a1 (patch)
tree7fe7b8f983083f4970d55e5c94f26299ff19d1c1 /pairwise.pl
downloadpnit-main.tar.gz
pnit-main.zip
working perl codeHEADmain
Diffstat (limited to 'pairwise.pl')
-rwxr-xr-xpairwise.pl22
1 files changed, 22 insertions, 0 deletions
diff --git a/pairwise.pl b/pairwise.pl
new file mode 100755
index 0000000..f721575
--- /dev/null
+++ b/pairwise.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+die "usage: $0 threshold file […]\n" unless $#ARGV > 0;
+
+my $threshold = shift;
+
+my $header = <>;
+chomp $header;
+my @headers = split /,/, $header;
+while (<>) {
+ chomp;
+ my @parts = split /,/;
+ for (my $i=1; $i <= $#headers; $i++) {
+ if (defined $parts[$i]) {
+ my $similarity = $parts[$i];
+ print "$parts[0],$headers[$i]\n" if $similarity >= $threshold;
+ }
+ }
+}