akm2 has asked for the wisdom of the Perl Monks concerning the following question:
&readbksic(); &readbkprm(); $pss = "$in{'productsearch'}"; &productsearchbymodel($pss); &productsearchbydesc($pss); @matchlist = (@modelmatches,@descmatches); my @matches = keys %{ { map {$_=>1 } @matchlist} }; &DisplayHTML('/usr/local/apache/post/invorder.pl/screens/display_produ +cts_top.html'); foreach $linenumber (@matches){ $VCD = $BKSIC_MFG[$linenumber]; $VMN = $BKSIC_MODEL[$linenumber]; $VPD = $BKSIC_DESC[$linenumber]; $QOH = $BKSIC_QOH[$linenumber]; &DisplayHTMLOnly('/usr/local/apache/post/invorder.pl/screens/displ +ay_products_middle.html'); } &DisplayHTMLOnly('/usr/local/apache/post/invorder.pl/screens/displ +ay_products_bottom.html'); exit; } } sub productsearchbymodel { my $modelterms = shift; my $modelpattern = join "|", split " ", $modelterms; my $modelcase = $in{'case'} eq 'insensitive'?"(?i)":""; $modelpattern = qr/$modelcase$modelpattern/; # my @modelmatches = grep { /$modelpattern/ } @BKSIC_MODEL; #This w +ill store the actual matching string my @modelmatches = grep { $BKSIC_MODEL[$_] =~ /$modelpattern/ } 0. +.$#BKSIC_MODEL; #This will store the index ID of the matching array e +lement. return @modelmatches; } sub productsearchbydesc { my $descterms = shift; my $descpattern = join "|", split " ", $descterms; my $desccase = $in{'case'} eq 'insensitive'?"(?i)":""; $descpattern = qr/$case$pattern/; # my @descmatches = grep { /$descpattern/ } @BKSIC_DESC; #This will + store the actual matching string my @descmatches = grep { $BKSIC_DESC[$_] =~ /$descpattern/ } 0..$# +BKSIC_DESC; #This will store the index ID of the matching array eleme +nt. return @descmatches; }
When I perform only 1 search the code works fine. When I try to perform both, no matches are found.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Conflicts combining arrays?
by merlyn (Sage) on Mar 22, 2001 at 21:14 UTC | |
|
Re: Conflicts combining arrays?
by arturo (Vicar) on Mar 22, 2001 at 21:28 UTC | |
|
Re: Conflicts combining arrays?
by dvergin (Monsignor) on Mar 22, 2001 at 21:18 UTC |