I have a lot of functions starting with a given prefix. I would like to create an array of these functions and then execute them one by one.
Consider:
use v5.12;
my @names = qw(a b);
my @ss = map { "s".$_ } @names;
sub sa {
say "a";
}
sub sb {
say "b";
}
Here the function prefix is s. How do I call these functions one by one, for instance, using a for loop..? (I tried inserting a \& inside the map command, but that did not work.)
Note that all the functions will take the same arguments, and that's why I think this is something that could be useful to do...