First, I'll answer the question, then question the proposed code.
Double quotes do not interpolste sub calls. The need, then, is to provide a context which does. The @ and $ sigils are interpolated in qq(), so "@{something}" and "${something}" are the choices. @{[foo]} needs an array ref inside, hence the square braces. "${\foo}" also works.(foo should already be defined)
If you wish to make the call in scalar context, it is tempting to try "${\foo}" but that remains in list context. You need explicit scalar to get that.
Now to your proposed code. You are using symbolic references when there is no need at all. Is the $i suffix you are trying to use supposed to be interpolated from the loop variable for my $i (1..2) {}? Why not make an honest array of sub refs? Viz:
for (\&cut, \&paste, \&publish) {
print LOG "@[[localtime]} did:", &$_,$/;
}
Second, why do you need to place the calls in quotes? If you need to produce stereotyped strings, @strings = map sprintf is to be preferred.
Update; fixed typo in code, clarified function name scope issue.
After Compline, Zaxo |