Possible Duplicate:
What are valid Perl module return values?
Generally we use 1; at the end of the module. This is to indicate that module returns true and can be imported properly. Now if we return 0 means false, that means module fails in import.
My question is, What if I use (or return) below statements at the end of module
-1;some text;- or
abc;
Does -1 means error, and some text,abc means true
Also what if I don’t use 1; or any statement (as above) at all, what does module return in that case?
Does it return undef?
Any true value indicates success. -1 is a true value.
The return doesn’t have to be at the end of the file; it is the return value of the last executable statement (that is, the last statement that isn’t just a compile-time thing like package, use, no, sub, format).
For example, the requiring a file containing the following:
will fail if @foo::x is empty and otherwise succeed.
If there indeed are no executable statements, the return value is taken to be undef (false).