You forgot to wrap in BEGIN {}.
#! perl -slw #use HTTP::Status; BEGIN { require HTTP::Status; import HTTP::Status; } print RC_FORBIDDEN; __DATA__ P:\test>test4 ## This is with c<use> 403 P:\test>test4 ## This is with require/import but no BEGIN Name "main::RC_FORBIDDEN" used only once: possible typo at P:\test\tes +t4.pl line 5. print() on unopened filehandle RC_FORBIDDEN at P:\test\test4.pl line 5 +. P:\test>test4 ## This is with require/import inside BEGIN 403
Updated to add complete code listing with output.
In reply to Re^3: When C<use Module;> *not* the same as C<require Module; import Module;>?
by Mr. Muskrat
in thread When C<use Module;> *not* the same as C<require Module; import Module;>?
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |