#!/usr/bin/perl -w use strict; open( MOL, "molecules" ) or die "ack! - $!"; push my @molecules, quotemeta chomp while ; close MOL or warn "ack - $!"; my $bigRegex; $bigRegex = join '|', map { "\b$_\b" } sort { length $b <=> length $a } @molecules; open( LOCUS, "locus" ) or die "ack! - $!"; my @locus = ; close LOCUS or die "ack! - $!"; for(@locus) { print if( scalar( split /\t/ ) >= 6 && /^([^\t]*\t)?($bigRegex)/ ); }