sub process_article { my $fh=shift; # Filehandle my $locations=shift; # Reference to hash containing location information for this article my $keywords=shift; # Reference to an array containing keywords my $all=shift; # Reference to a list of all keywords or chromosomal bands found if (-e "$$locations{file}") { # If file exists in the location indicated by the index file open(INFO, "$$locations{file}") or die("cannot open file $$locations{file}: $!"); } else { # If not, search for it my ($file)=($$locations{file}=~/.+\/(.+)/); # Get just the filename find(sub{m/$file/ and $file=$File::Find::name}, 'c:/perl' ); open(INFO, "$file") or die("cannot open file $file: $!"); } seek (INFO, $$locations{offset}, 0); # Set location to article my $string=; # Get line from file my ($title, $line, $abstract)=($string=~/(.+?)\t(.+)\t(.*)/); if (@$keywords) { # If keywords were provided my ($score, @found)=find_keywords($title.' '.$abstract, @$keywords); # Get keywords push @$all, @found; my $kwords_found=join('|', @found); print $fh "$title\t$line\t$kwords_found\t$score\n" if ($score>0); # Print line } else { # No keywords provided, means look for chromosomal bands my ($score, @found)=find_bands($title.' '.$abstract); # Get chromosomes push @$all, @found; my $chroms_found=join('|', @found); print $fh "$title\t$line\t$chroms_found\t$score\n" if ($score>0); # Print line } close(INFO); }