I would suggest that you not use perl. grep has built in switches to handle exactly this case.
Except, of course, in the very common case that this code is part of a larger script or chain of processing, in which case calling grep as an external program has more disadvantages than just doing everything in Perl.
In reply to Re^2: Regex variables with delimiters
by haukex
in thread Regex variables with delimiters
by clerew
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |