in reply to Passing function to a function using \&<function name> method

3dan already answered your actual question: you want $coderef->(@args). I've just got a minor point of terminiology to clear up. \&foo does not return the address of &foo, it returns a reference to &foo.

The difference is important, if somewhat subtle. The address of &foo is just a number, without intrinsic meaning. A reference to &foo "knows" what it's pointing at, and indeed, that it's pointing at something. It serves as an indicator to perl that what it's refering to is not garbage, and that it can't be thrown away just yet, while there is still a refernce to it.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).