in reply to grep {CONSTANT} @list
Nothing to do with grep in particular, or constants.
use constant REGEXP => qr(a); print grep { REGEXP } qw(a b c);
... is equivalent to:
my @tmp; foreach (qw(a b c)) { push @tmp, $_ if qr(a); } print @tmp;
See the problem now? if qr(a) is always true. if qr(anything) is always true.
Try:
print grep { $_ =~ REGEXP } @list;
|
|---|