You're attempting to use the number of keys which matched to initialize a hash. Trying to use a single scalar to initialize a hash isn't going to produce anything useful.
my @desired_keys = grep { /\Q$dir\E.*?\.pm$/ } keys %$packlist; my %hash; @hash{ map { /\Q$dir\E(\w+?)\.pm$/; $1 } @desired_keys } = @desired_ke +ys;
Update: Gah. Me no write well. Reworded to (hopefully) clarify.
In reply to Re^3: warnings and grep problem
by Fletch
in thread warnings and grep problem
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |