#!/usr/bin/perl -w use strict; use warnings; use vars qw(%origins); if( @ARGV < 3){ print "usage: A message here\n"; exit 0; } open(INPUT1,$ARGV[0]) || die "Cannot open file \"$ARGV[0]\""; #Orginal IDs and four letter codes open(INPUT2,$ARGV[1]) || die "Cannot open file \"$ARGV[1]\""; #Orginal IDs in the second column open(RESULTS,">$ARGV[2]")|| die "Cannot open the Results file \"$ARGV[2]\""; # Origanl IDs will change to four letter code my %origins; while () { chomp; my @columns = split '\t'; $origins{$columns[0]} = $columns[1]; } close(INPUT1); while () { chomp; (my $bioC, my $contig_id , my $pip) = split("\t", $_); for my $oKey (sort keys %origins) { my $origin = $origins{$oKey}; if ($contig_id eq $oKey){ print RESULTS "$bioC\t$origin\t$pip\n"; #print "$bioC\t$origin\t$pip\n"; } } } close(INPUT2); close(RESULTS);