in reply to Re: Re: Calling a function that may not be there...
in thread Calling a function that may not be there...

Said knobunc:
That would work if there was a reference to the function involved. The original case had a simple subroutine definition.
OK, you're wrong, and you obviously didn't try it, or even look in the manual.

Says perlfunc:defined:

You may also use defined(&func) to check whether subroutine &func has ever been defined.
With all that code you wrote to show off, I would have thought you could also write the following three-line test to avoid embarassing yourself:
sub a1 {} print "a1 is defined\n" if defined &a1; print "a2 is defined\n" if defined &a2;