At 10:38 PM +0800 4/20/05, Autrijus Tang wrote:
In Pugs's t/pugsbugs/map_function_return_values.t, iblech added this test:
    %ret = map { $_ => uc $_ }, split "", $text;

This fails because it is parsed, undef the {=>} autocomposition rule, into:
    # Fails because arg1 is not Code
    %ret = map(hash($_ => uc $_), split("", $text));

Instead of the intended:
    # Works correctly
    %ret = map(sub ($_) { $_ => uc $_ }, split("", $text));

Is this a known issue?

A clear way to disambiguate a block from a hash-ref when using map/grep/sort etc is to use a colon before the leading brace for a block rather than a space, like this:


   map:{ $_ => uc $_ }

I read that in the synopsis documents a month back, though I'm having a bit of trouble finding the reference now. Maybe it has something to do with adverbs? But I do explicitly remember it being used to disambiguate.

In any event, I used that form exclusively with my Perl 6 ports to date.

So in that case, the test is wrong.

-- Darren Duncan

Reply via email to