in reply to Deleting a matching string in an array
I think what you want is this:
# if you want @robots to be interpreted as # regexes, delete the map { ... } my $regex = join '|', map { quotemeta $_ } @robots; for (grep { ! /$regex/ } @logmessages){ print OUTFILE $_; }
Note that grep doesn't modify its arguments (normally...), so you have to continue working with the result from grep.
(Update: added the ! in grep, ... ;-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Deleting a matching string in an array
by johngg (Canon) on Oct 30, 2007 at 17:04 UTC | |
|
Re^2: Deleting a matching string in an array
by naikonta (Curate) on Oct 30, 2007 at 16:15 UTC | |
by moritz (Cardinal) on Oct 31, 2007 at 06:36 UTC | |
|
Re^2: Deleting a matching string in an array
by Shamaeso (Initiate) on Oct 30, 2007 at 17:12 UTC | |
|
Re^2: Deleting a matching string in an array
by KurtSchwind (Chaplain) on Oct 30, 2007 at 15:27 UTC |