in reply to Remove multiple lines in file if pattern found based on array element, in perl
Perl's /i runtime flag does not apply exactly to your situation, but it is a good idea to imitate its file renaming etc.
You can test for all the elements of the array at once.
my $rprow = join '|', @remove_power_list; $rprow = qr/(?:$rprow)/;
Use $rprow as before, but the loop on @remove_power_list is no longer needed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Remove multiple lines in file if pattern found based on array element, in perl
by MatD (Initiate) on Nov 07, 2014 at 21:55 UTC |