#!/usr/bin/perl -w use strict; use Data::Dumper; my $inputfile1 = $ARGV[0]; my $inputfile2 = $ARGV[1]; open (FILE1, $inputfile1) or die; open (FILE2, $inputfile2) or die; my @fruit = ; # fruit.txt close FILE1; my @strands = ; ## strands.txt close FILE2; my (@fruitcolumn, @strand_direction, %strands, $key, $value); foreach my $line(@strands) { my @colsplit = split("\t", $line); push (@fruitcolumn, $colsplit[0]); push (@strand_direction, $colsplit[1]); } s/\s+$// foreach @strand_direction; s/\s+$// foreach @fruit; while ($key = shift (@fruitcolumn)) { $value = shift (@strand_direction); push @{$strands{$key}}, $value; } foreach my $line (@fruit) { if ($strands{$line} =~ m/\+/) { print "my positives are $line", "\n"; } elsif($strands{$line} =~ m/\-/) { print "my negatives are $line", "\n"; } }