Abhijit Mahabal wrote:

I am a little confused if the following is valid perl6:

our &xsub = { $x };

No. Illegal attempt to assign to a reference. You want aliasing/binding instead:

  our &xsub := { $x };

(I like to think of := as "assignment to symbol table entry".)


If you wanted to get a function for each element in an array @a, I suppose you can say:

sub makefunc($x){{$x}}
@funcarray = @a>>.makefunc;

You're attempting to call a sub as a method. You want:

  @funcarray = »makefunc« @a;

Damian

Reply via email to