Here's something that's rather crass, but maybe something like it will save you from venturing into dark regions:

c:\@Work\Perl\monks>perl -wMstrict -le "sub working { my @x = (1, 0, 2); my @y = grep { print qq{in grep: '$_'}; return 'byebye'; } @x; print 'still in working(): ', qq{(@y)}; return @y; } my @z = working; print qq{from working(): (@z)}; " in grep: '1' from working(): (byebye) c:\@Work\Perl\monks>perl -wMstrict -le "sub mygrep (&@) { my $code = shift; my @result; for (@_) { no warnings 'exiting'; push(@result, $_) if map { print 'in map: ', qq{'$_'}; $_; } &$code; } MYGREP_FINAL: return @result; } ;; sub notworking { my @x = (4, 0, 3); my @y = mygrep { print qq{in mygrep: '$_'}; goto MYGREP_FINAL; } @x; print 'still in notworking(): ', qq{(@y)}; return @y; } ;; my @z = notworking; print qq{from notworking(): (@z)}; " in mygrep: '4' still in notworking(): () from notworking(): ()


Give a man a fish:  <%-{-{-{-<


In reply to Re: Bare BLOCK vrs. grep BLOCK by AnomalousMonk
in thread Bare BLOCK vrs. grep BLOCK by powerin

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.