if ( defined &test_sub ) { test_sub(); } else { print "Subroutine doesn't exist"; }