Daniel Carrera wrote:
I tested the first program using the latest release of Rakudo Star.
The first program has the following:

my @sorted = @names.sort({ %sets{$_} }).sort({ %matches{$_} }).reverse;

This works correctly, but it's long and I'd rather format this line like this:

This works correctly, but I was surprised that this doesn't:

my @sorted = @names.sort({ %sets{$_} })
                   .sort({ %matches{$_} })
                   .reverse;

I was surprised when this didn't work. Does anyone know if this is a
bug in Rakudo, or if Perl 6 is really not supposed to have methods
separated by white space like this? The message from Rakudo was not
very informative. It just says "Confused at line 28, near my @sorted".

A relevant reading would be http://perlcabal.org/syn/S02.html#Whitespace_and_Comments I think; what you are trying to do may not directly be allowed, though there may be workarounds such as by using "unspace".

-- Darren Duncan

Reply via email to