|Problems? Is your data what you think it is?|
use and require inside subsby Anonymous Monk
|on Nov 02, 2004 at 23:11 UTC||Need Help??|
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
sorry monks, I feel like this is info I should be able to find somewhere but I cant.
I have lots of subroutines, many of which use various modules or other subroutines I've made.
I use require 'myperlsub.pl' to include my subroutines and of course 'use' to include modules. What I would like to do is put 'use' and 'require' statements into my subroutines, since sometimes they will be called from scripts that already use and require the necessary subs and modules and sometimes not.
I've read that 'require' will handle double declarations just fine, but I've also read that I should use 'do myperlsub.pl' instead.
I can't find anything that says one way or the other how 'use' will handle this.
Please advise. Thanks.