June 2002
Beginner
759 pages
80h 42m
English
map
map {block} list
map expr, list
Evaluates the block or
exprfor each element of
list (locally setting $_ to each element) and returns the list
value composed of the results of each evaluation. It evaluates
block or
exprin a list context, so each element
of listmay produce zero, one, or more
elements in the returned value. These are all flattened into one
list. For instance:
@words = map { split ' ' } @lines;splits a list of lines into a list of words. Often, though, there is a one-to-one mapping between input values and output values:
@chars = map chr, @nums;
This statement translates a list of numbers to the corresponding characters.