#!/usr/bin/perl use strict; use warnings; my $in_file = $ARGV[0] or die "Usage: "; my $in2_file = $ARGV[1] or die "Usage: "; open(my $fh, '<', $in_file) or die "Unable to open '$in_file' for reading: $!"; my %bead; while (<$in_file>) { chomp; my ($snp, $chr, $beadpoolid) = split /,/; $bead{$snp} = $beadpoolid; } open($fh, '<', $in2_file) or die "Unable to open '$in2_file' for reading: $!"; while (<$fh>) { next if ! /^SNP\s+Coor/; chomp; my ($snp, $coor, $allele, @int) = split /\t/; next if ! $bead{$snp}; print join("\t", $bead{$snp}, $snp, @int), "\n"; }