Code:
sub normal_search
{
### PERFORM SEARCH
$search_line = $fields{'keywords'};
$icnt = 0;
$toadk = "";
open (SIDX, "$data_dir/search.idx");
open (SIDX2, "$data_dir/search2.idx");
Code:
my @sidx = <SIDX>;
my @sidx2 = <SIDX2>;
@sidx = grep {$_ ne ""} @sidx;
@sidx2 = grep {$_ ne ""} @sidx2;
@skeyw = (\@sidx, \@sidx2);
## How do I join @sidx, @sidx2 into @skeyw ##
#my $line = join('|', @sidx, @sidx2);
#$line = qr/$line/;
(@skeyw) = split(/ /,$search_line);
$nrkeywords = 0;
foreach $item (@skeyw){$nrkeywords++;}
Then return the results from both files
Code:
{
$sline = $line;
}
{
foreach $kwr (@skeyw)
{
if (($sline =~ /$kwr/i) and ($kwr ne ""))
{
$toadk = "true";
}
}
if ($toadk eq "true")
{
$resultline[$icnt] = $line;
$toadk = false;
$icnt++;
}
}
#if ($file_locking ne "No"){flock (CIT, LOCK_UN);}
close (SIDX);
close (SIDX2);
}