tsk1979 has asked for the wisdom of the Perl Monks concerning the following question:
Is there a more efficient way? @some_array can be very very large file. So first creating such a big array and then parsing it so many times looks inefficient. Moreover this will spoil the order. I want to find all lines which match the list of regexps.open file @some_array = <file> foreach $pattern (@matcharray) { grep {/$pattern/}@some_array }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Usage of grep on a file
by GrandFather (Saint) on Apr 07, 2006 at 07:26 UTC | |
by tsk1979 (Scribe) on Apr 07, 2006 at 07:30 UTC | |
by GrandFather (Saint) on Apr 07, 2006 at 07:37 UTC | |
by parv (Parson) on Apr 07, 2006 at 07:34 UTC | |
|
Re: Usage of grep on a file
by Zaxo (Archbishop) on Apr 07, 2006 at 07:34 UTC | |
|
Re: Usage of grep on a file
by rafl (Friar) on Apr 07, 2006 at 07:36 UTC | |
by jwkrahn (Abbot) on Apr 07, 2006 at 09:51 UTC | |
|
Re: Usage of grep on a file
by aquarium (Curate) on Apr 07, 2006 at 12:17 UTC | |
|
Re: Usage of grep on a file
by ambrus (Abbot) on Apr 07, 2006 at 10:17 UTC |