Hi, I have been programming Perl for years and should probably know this but it is one of those things I have never seen in black and white:
If I have a script like this:
...
require "subs.pm";
require "moresubs.pm";
$valueA = &somethingInSubs;
$valueB = &somethingInMoresubs;
...
Will a subroutine in my "moresubs.pm" file be able to call subroutines in "subs.pm" ? Or will I have to put 'require "subs.pm";' inside "moresubs.pm" ?
When I try it out it seems to work, but most books I have looked at try to avoid explaining scope and I have never had a straight answer to this. I don't really like rellying on something which 'seems' to work without being certain that it is supposed to function that way.
I know that it is safe to perform a 'require' multiple times as it will be ignored if it is found more than once, but it would be nice to know what is actually going on.
Many thanks,
If I have a script like this:
...
require "subs.pm";
require "moresubs.pm";
$valueA = &somethingInSubs;
$valueB = &somethingInMoresubs;
...
Will a subroutine in my "moresubs.pm" file be able to call subroutines in "subs.pm" ? Or will I have to put 'require "subs.pm";' inside "moresubs.pm" ?
When I try it out it seems to work, but most books I have looked at try to avoid explaining scope and I have never had a straight answer to this. I don't really like rellying on something which 'seems' to work without being certain that it is supposed to function that way.
I know that it is safe to perform a 'require' multiple times as it will be ignored if it is found more than once, but it would be nice to know what is actually going on.
Many thanks,