Reputation: 2103
I am trying to use this syntax to call a function "$name"()
. I know this works for methods, but I do not if there is a way to do it with functions from a module.
I have tried this => sub b(){say "b";}; "b"();
, but it does not work.
Any idea?
Upvotes: 9
Views: 167
Reputation: 2103
@sena_kun has answerd me via Perl6 IRC channel, and it looks like the correct syntax would be: sub b(){say "best" }; ::('&b')();
.
As you can see that looks like "magic", so instead of that, @sena_kun has told me this more comprehensible way: sub a {1.say}; sub b {2.say}; my @a = &a, &b; for @a -> &f { &f()}
Upvotes: 8