in reply to checking from a module if a sub exists in main::
my $package = 'main'; my $function = 'foo'; { no strict 'refs'; if (defined &{$package.'::'$function}) { print "$function is defined in $package\n"; } }
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
|---|