"be consistent" | |
PerlMonks |
Re: How do you determine if a user-defined function exists?by ysth (Canon) |
on Nov 30, 2004 at 07:12 UTC ( [id://411121]=note: print w/replies, xml ) | Need Help?? |
defined &myfunc will tell if it is defined, but usually (especially for imports from modules) it is better to see if it is declared instead; exists &myfunc will do that. The difference is functions that have a forward declaration like sub myfunc; and are implemented via AUTOLOAD (e.g. AutoLoader/SelfLoader). exist &foo will be true for these functions, but defined &foo will not.
In Section
Seekers of Perl Wisdom
|
|