It's easier to see the diff here:
$ diff -u \ <( perl -MO=Concise,-exec -e'@vals = map $_*5, @vals;' 2>&1 ) \ <( perl -MO=Concise,-exec -e'@vals = map { $_*5 } @vals;' 2>&1 ) --- /proc/self/fd/63 2010-01-24 01:45:47.147224485 -0800 +++ /proc/self/fd/62 2010-01-24 01:45:47.123224005 -0800 @@ -1,18 +1,19 @@ -e syntax OK 1 <0> enter -2 <;> nextstate(main 1 -e:1) v +2 <;> nextstate(main 2 -e:1) v 3 <0> pushmark s 4 <0> pushmark s 5 <#> gv[*vals] s 6 <1> rv2av[t6] lKM/1 -7 <@> mapstart lK/2 -8 <|> mapwhile(other->9)[t7] lK/1 +7 <@> mapstart lK*/2 +8 <|> mapwhile(other->9)[t8] lK/1 9 <#> gvsv[*_] s a <$> const[IV 5] s b <2> multiply[t4] sK/2 +- <@> scope lK goto 8 c <0> pushmark s d <#> gv[*vals] s e <1> rv2av[t2] lKRM*/1 -f <2> aassign[t8] vKS/COMMON +f <2> aassign[t9] vKS/COMMON g <@> leave[1 ref] vKP/REFC

It's very unclear what that means. The leading "-" means it's not executed, yet it's still showing in the -exec listing. What does that OP do anyway? It's executed at the *end* of the callback code. Looking at the source doesn't help

PP(pp_scope) { dVAR; return NORMAL; }

Without a lot more digging, B::Concise's output does really help. On the other hand, it's very easy to show that a scope does get created for map BLOCK but not for map EXPR,

...or not.

$ perl -wle'use strict; map +(my $x = $_), 2; print $x' Use of uninitialized value in print at -e line 1.

It seems a run-time scope is created for map EXPR,.

(Compile-time scope affects the visibility of lexical variables. Run-time scopes control when they get cleared. They should be the same, but sometimes they're not.)


In reply to Re^2: syntax of map operator by ikegami
in thread syntax of map operator by sman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.