in reply to Searching an array with an array of regexes
If you want to collect a series of regular expressions to test each line against, I would suggest using an array of regex references - see Regexp Quote Like Operators in perlop. That way each test is independent. I like to use the special variable $" to join the resulting regular expressions with alternators, though you could use grep to test each individually. Perhaps something like:
#!/usr/bin/perl use strict; use warnings; my @ignore_list = ( qr/^\Qwords\:\:moreWords_\E\d+/i, qr/^[^:]+$/ ); local $" = '|'; while (<DATA>) { print unless /@ignore_list/; } __DATA__ words\:\:moreWords_68 words\:\:moreWords_92 words\:\:fewerWords_92 words\:\:moreWords_a7 birds\:\:moreWords_68 item
|
|---|