I think the main problem you are having is the implicit loop that grep creates. grep actually creates another loop which sets $_.
Also your outside loop over @required never sets $_ since you explicitly create a variable.
ex.
my @required = qw(preserver sunscreen water_bottle jacket); foreach my $item (@required) { print "$_\n"; ## You just get a warning }
In reply to Re: grep and $_
by grep
in thread grep and $_
by convenientstore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |