#!/usr/bin/perl use warnings; use strict; use diagnostics; my %hash; #$damID, $damF, $damAHC, $prog my $damF = <) { chomp $line; next unless $line =~ /\S/; #skip blank lines my ($ID, $F, $AHC) = (split (/\s+/, $line))[0,3,5]; $hash{$ID} = "$F\t$AHC"; } close FILE1; open (FILE2, '<', \$damF) or die "Can't open damF.txt"; #open (OUT, ">output.txt") or die "Can't Open output file"; #print OUT "\n"; while (my $line = ) { chomp $line; next unless $line =~ /\S/; #skip blank lines my ($damID, $damF, $damAHC, $prog) = split (/\s+/, $line); if ($hash{$prog}) { my $info1 = $hash{$prog}; my $info2 = "$damID\t$damF\t$damAHC"; print "$prog\t$info1\t$info2\n"; } } #close OUT; close FILE2; print "Done";