in reply to Nested foreach
Now it's just a matter of writing @words back to the original file. See. quotemeta, join, map and lc for info on the functions used in the above snippet, perlsyn for info on the for modifier and perlre for further details of the regex used.## build a regular expression to match all the words in @ignore my $ignore = '(?:\b'. join('\b|\b', map quotemeta, @ignore). '\b)'; ## assuming @words contains the contents of the file s/$ignore// for map lc, @words;
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: Nested foreach
by merlyn (Sage) on Apr 25, 2003 at 15:37 UTC | |
by broquaint (Abbot) on Apr 25, 2003 at 15:44 UTC |