Jeremy Vinding <[EMAIL PROTECTED]> writes: >> >> @array = <SOME_FILE>; >> @res_grep1 = grep /pattern1/, @array; >> @res_grep2 = grep /pattern1/, @res_grep1; >> @res_grep3 = grep /pattern1/, @res_grep2; >> > how about something like: > > @res = grep { /pattern1/ && /pattern2/ && /pattern3/ } <SOME_FILE>;
Nobody has mentioned this approach yet, but it looks like you may want the hits in arrays from your example code. may: while(<>){ $line = $_; if($line =~ /pattern1/){ push @pat1_array,$line; } if($line =~ /pattern2/){ push @pat2_array,$line; } # <as many ifs as you like> } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]