我可以将这个 Perl 合并到一个 map-grep 链中吗?一个小声音说我应该可以,但我不知道怎么做!
# expand sponsor keys in to a list of sponsor objects.
foreach my $event (@events) {
next unless exists $event->{sponsors} && ! ref $event->{sponsors};
$event->{sponsors} =
[ map { $lookup{$_} }
grep { exists $lookup{$_} }
split( /\s*,\s*/, $event->{sponsors} ) ];
}