Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: map sub to list? (glossary)

by LanX (Saint)
on Sep 09, 2013 at 17:44 UTC ( [id://1053059]=note: print w/replies, xml ) Need Help??


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)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1053059]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-28 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found