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.
*******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to