Would this work for you? Just take a reference to $_.
my @array_2 = grep {my $element = \$_; $$element =~ /foo/} @array_1;
lupey
In reply to Re: How to avoid $_ in grep
by lupey
in thread How to avoid $_ in grep
by felipe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |