http://www.perlmonks.org?node_id=795696


in reply to Re^2: Searching and Coutning using 2 files with multiple columns
in thread Searching and Coutning using 2 files with multiple columns

Hmm... It works for me as desired on your sample data.

What delimiters do you use between columns? What is your OS?

Please try this one:

#!/usr/bin/perl -lan BEGIN { die "Usage: $0 Boundary.out DB.out" unless @ARGV == 2; } if ( $isDB ) { print join "\t", @F, ~~grep { $_->[0] > $F[2] && $_->[1] < $F[3] } @{$chr{$F[1]}} } else { push @{$chr{$F[0]}}, [ @F[1, 2] ]; $isDB = eof; }

Replies are listed 'Best First'.
Re^4: Searching and Coutning using 2 files with multiple columns
by shart3 (Novice) on Sep 17, 2009 at 15:27 UTC

    Thanks. PROBLEM SOLVED!! Your original post worked! I had to remove a hard return in my text file that was screwing everything up

      OK. And now you have a challenge to understand why does it work. :)