my %hash = map {$gp1[$_] => $gp2[$_]} 0 .. $#gp1; #13488050:c183911-182727 57165207:6809301-6810488 #### foreach my $line (@blast) { if ($line =~ /gi\|(\d+.{1,2}\d+\-.{0,1}\d+)\s+gi\|(\d+.{1,2}\d+\-.{0,1}\d+)\s+(\d{0,2}.{0,2}\d{0,2}.{0,2}\d{0,3})\s+\d+\s+(\d+.{0,3}\d+)\s+\d+\s+\d+\s+\d+\/\d+\s+(\d+)/) { ###print "$1\t$2\t$5\n"; my $n1 = $1; push @id1, "$1 "; push @id2, "$2 "; push @percent_id, "$5 "; # need to here check whether $1 eq key and $2 eq value but am stuck! } }