On Sun, Feb 17, 2008 at 10:42:34PM +0100, Jonathan Worthington wrote: > And while I'm rambling about this kinda stuff, I discovered this because I > was actually looking at cases where we pass blocks off to things like grep. > > my @b = @a.grep: { $_ > 42 }; > > I'm thinking that $_ is really a parameter to this block, so in grep you'd > do "if $condition($elem) { ... }" to invoke the conditional block. However, > I guess we'd better make it an optional parameter, otherwise you can't > write stuff like: > > sub pointless($call) { > $call(); > } > pointless { say "foo" };
When you can't know, we parse a block to something like: <-> $_ = OUTER:<$_> {...} Larry