In Perl both grep and map take an expression and a list, and evaluate the expression for each element of the list.
grep
map
What is the difference b
Facetiously: grep gives its block scalar context, map gives its block list context. (And BLOCK foreach LIST gives its block void context.)