Files which are loaded by use or require must return a true value. That is usually done by making the statement, 1; the last perl statement in the file. If you exit the file early with return, a true value represents success, false an error condition.
The major difference between use and do is that use happens at compile time as if it were in a BEGIN block, but do, like require, happens at runtime. There are also differences in the scope of variables and the matter of the return value you found. See perlfunc for details.
After Compline,
Zaxo
In reply to Re: Using "USE" instead of "DO" for subroutines call in external file
by Zaxo
in thread Using "USE" instead of "DO" for subroutines call in external file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |