@result = grep {/pattern1/  && /pattern2/ && /pattern3/} @array;

On Wednesday, July 10, 2002, at 06:16 PM, Robert Kasunic wrote:

> Hi,
>
> I am looking for an efficient way to do consecutive grep's in perl, i.
> e. a possibility to resemble something like
>   'cat some_file | grep pattern1 | grep pattern2 | grep pattern3'.
>
> I know I can do that as follows:
>
> @array = <SOME_FILE>;
> @res_grep1 = grep /pattern1/, @array;
> @res_grep2 = grep /pattern1/, @res_grep1;
> @res_grep3 = grep /pattern1/, @res_grep2;
>
> But that doesn't look to nice, especially when thinking about more
> grep statements.
>
> TIA
> Robert
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
// George Schlossnagle
// Principal Consultant
// OmniTI, Inc          http://www.omniti.com
// (c) 240.460.5234   (e) [EMAIL PROTECTED]
// 1024D/1100A5A0  1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to