http://www.perlmonks.org?node_id=1053059


in reply to Re^4: map sub to list?
in thread map sub to list?

> Where can I read about functions that have comma and non-comma parsings?

in my own words:

BLOCK means { code } in curlies, like map { $_ +1 } 1..3, so no comma

DB<124> map { $_ +1 } 1..3 => (2, 3, 4)

EXPR can be any "atomar" code-snippet.

DB<128> map sqrt , 1..3 => (1, "1.4142135623731", "1.73205080756888") DB<129> map 5 , 1..3 => (5, 5, 5)

in both cases the list values are passed by setting a special variable (aka default variable) $_

according to perlglossary

BLOCK A syntactic construct consisting of a sequence of Perl stat +ements that is delimited by braces. The "if" and "while" statemen +ts are defined in terms of BLOCKs, for instance. Sometimes we als +o say "block" to mean a lexical scope; that is, a sequence of sta +tements that act like a "BLOCK", such as within an eval or a file, +even though the statements arenít delimited by braces. ... expression Anything you can legally say in a spot where a "value" is required. Typically composed of literals, variables, opera +tors, functions, and "subroutine" calls, not necessarily in that +order.

Cheers Rolf

( addicted to the Perl Programming Language)