Yes, there is a difference, use use and not require
should be documented in perlsub
if you use require, you'll need to use a forward declaration
$ perl -le "sub f($$@@){warn qq{@_}} f(@ARGV,@ARGV,@ARGV); " 1 2 3 4 5 5 5 1 2 3 4 5 at -e line 1. ## simulate "require" $ perl -le " eval q{sub f($$@@){warn qq{@_}}}; f(@ARGV,@ARGV,@ARGV); " + 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 at (eval 1) line 1. ## forward/early/prototype declaration $ perl -le " sub f($$@@); eval q{sub f($$@@){warn qq{@_}}}; f(@ARGV,@A +RGV,@ARGV); " 1 2 3 4 5 5 5 1 2 3 4 5 at (eval 1) line 1.
In reply to Re: Any difference between use and require regarding honoring prototype defined for sub? (prototype)
by Anonymous Monk
in thread Any difference between use and require regarding honoring prototype defined for sub?
by stewart_lee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |