require and therefore use execute the specified module just like a script. They expect the specified module to return a true value when executed. The return value of a module is the value returned by the last expression evaluated when the module is executed (just like for subs). 1 is a true value. You could change 1 to "A true value to satisfy require and/or use" (which is also a true value), and it would work just as well.
This might be best explained by showing what happens when 1 is changed to 0:
>type Module.pm package Module; # ... 0; >perl -e"use Module;" Module.pm did not return a true value at -e line 1. BEGIN failed--compilation aborted at -e line 1.
In reply to Re: what does 1; does?
by ikegami
in thread what does 1; does?
by MelaOS
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |