#!/usr/bin/perl -w use strict; use warnings; 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, $contig_id, $pip ) = split("\t", $_); print RESULTS "$bioC\t$origins{ $contig_id }\t$pip\n"; } } close(INPUT2); close(RESULTS);