I'm trying to get the effect of grep(!/re/, @array) with the /re/ saved in a variable. Nothing that I try seems to work. I don't find that there is any way to place the inversion within the regex variable, so I guess that it needs to go in the grep call. Starting with $tmp=qr/pattern/; I've tried grep(!$tmp, @array); and grep(! $tmp, @array); (that has a space added) and grep {! $tmp} @array;, but no joy. What variation would work?
In reply to Invert grep match with qr// variable by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |