On Wed, Nov 28, 2007 at 02:15:39AM -0800, howa wrote: > sub abc { > print 'abc'; > }
print "<", exists &abc, ">\n"; print "<", exists &abcee, ">\n"; > my $f1 = \&abc; > my $f2 = \&abcee; > > print $f1; # return CODE(0x..) > print $f2; # also return CODE(0x..) print "<", defined &abc, ">\n"; print "<", defined &abcee, ">\n"; > $f1->(); > $f2->(); > > How do I know if $f2 is a valid function reference, without actual > calling it? perldoc -f exists perldoc -f defined Note that a sub exists after taking a reference to it even though it won't necessarily e defined. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/