in reply to Re: Reading two files, cmp certain cols
in thread Reading two files, cmp certain cols

Hi Chris, I tried to use your code, first one that reads file1 and make the hash. Does not work very well. I think it does not make hash with multiple values. Because changing the -8 +8 does not change any thing for the $lo or $hi in the second part. Probably a hash of array would work.
my %file1=(); while(<INPUT1>){ chomp; (my $id, my $number) = split("\t", $_); if ($id=~ m/(^CLS_S3_Contig[0-9]+)([-]?)([0-9]+)([_]?)([0-9] ++)$/i) { #for (my $i=$3-8; $i<=$5+8; $i++){ # print join ("\t", $1, $i), "\n"; # push (@{$file1{$1}}, $i); $file1{$1} = [$3-8, $5+8]; } } #} foreach (my($k, $v) = (sort keys %file1)){ print "$k\t$v\n"; }
Results
CLS_S3_Contig1000 CLS_S3_Contig10000 CLS_S3_Contig1000 CLS_S3_Contig10000
I should have use DATA::DUMPER Got it