title: How can I determine if a Perl function exists at runtime?
body: <p>I'm working on a test framework in Perl. As part of the tests, I may need to add precondition or postcondition checks for any given test, but not necessarily for all of them. What I've got so far is something like:</p>
  
  <pre><code>eval "&amp;verify_precondition_TEST$n";
  print $@ if $@;
  </code></pre>
  
  <p>Unfortunately, this outputs "Undefined subroutine &amp;verify_precondition_TEST1 called at ..." if the function does not exist.</p>
  
  <p>How can I determine ahead of time whether the function exists, before trying to call it?</p>