Actually I am looking for AND and OR combinations..and the number of words
are not fixed.
ie @words is the variable and I need to have OR and AND combinations of
@words. to match in LINES
How do I go about it?


On 4/11/06, Wagner, David --- Senior Programmer Analyst --- WGO <
[EMAIL PROTECTED]> wrote:
>
> Sonika Sachdeva wrote:
> > $str1=shift;
> > $str2=shift;
> > $str3=shift;
> >
> > my $querystring="$str1 && $str2 && $str3";
> >
> > foreach (@LINES){
> >         push @output,$_ if /$querystring/ ;
> >         }
> >
>         Correct because unless you have abc && efg && hij in the $_ it
> will not work because that is prbably not what you are after.
>
>         if you are looking for all three to be there, then one way would
> be:
>         push @output,$_ if /$str1/ && /$str2/ && /$str3/ ;
>         which says if you find all three of the variables then put onto
> @output otherwise bypass.
>
>         But this is making the assumption you are not LOOKING for && as
> part of the string.
>
> Wags ;)
> > does not work even if I have @LINES containing all 3 words.
> >
> > Thanx,
> >
> > On 4/11/06, Peter Cornelius <[EMAIL PROTECTED]> wrote:
> >>
> >> What do you mean by 'works'?  It looks to me like this will print the
> >> line if the string 'pattern1 && pattern2 && pattern3' is in the
> >> line.  Not if pattern1 is in the line and pattern2 is in the line and
> >> pattern3 is in the line.  Is that what you mean?
> >>
> >> I think some more detail would help me to understand your question.
> >>
> >>> print $line if ($line =~ /pattern1 && pattern2 && pattern3/);
> >>>
> >>> works .. but
>
>
>
> *******************************************************
> This message contains information that is confidential
> and proprietary to FedEx Freight or its affiliates.
> It is intended only for the recipient named and for
> the express purpose(s) described therein.
> Any other use is prohibited.
> *******************************************************
>
>

Reply via email to