in reply to Unix 'grep -v' equivalency in Perl (was: Perl Regex Question)
Or join your input together (if it has no metacharacters):INPUT: while (<IN>) { for my $match (@list) { next INPUT if /$match/; } print; }
Update: Also, get in the habit of using strict, it may seem like a hassle at first, but makes things more maintainable in the long run.my $re = join "|", @list; while ... { print unless /$re/; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unix 'grep -v' equivalency in Perl (was: Perl Regex Question)
by tadman (Prior) on Jul 09, 2001 at 23:01 UTC | |
by tilly (Archbishop) on Jul 10, 2001 at 01:31 UTC | |
by runrig (Abbot) on Jul 10, 2001 at 02:07 UTC | |
by tadman (Prior) on Jul 10, 2001 at 21:13 UTC | |
by tilly (Archbishop) on Jul 10, 2001 at 21:55 UTC |