Ugh, hit "a" in gmail when replying!

On 5/5/05, Terrence Brannon <[EMAIL PROTECTED]> wrote:
> I was looking at a line in the hangman program:
>
>   @letters == @solution.grep:{ $_ ne '' };
>
> and was told that I was looking at an adverbial block.
The adverbial block is what you're giving to `if` when you say:

    if $foo { ... }

On the statement level, it looks like a block in operator position.
However, on the expression level, it is preceded by a colon, and goes
into the *& argument of the sub.

    sub grep (*&block, [EMAIL PROTECTED]) {...}

(I don't know about the ordering of those arguments)

It was invented to avert the annoying ({ }) construct, especially when
used in a series:

    @result = @input.grep:{...}.map:{...}

Did that answer your question?

Luke

Reply via email to