in reply to Any difference between use and require regarding honoring prototype defined for sub?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Any difference between use and require regarding honoring prototype defined for sub? (prototype)
by stewart_lee (Novice) on Nov 19, 2012 at 19:56 UTC | |
by Athanasius (Archbishop) on Nov 20, 2012 at 04:50 UTC | |
|
Re^2: Any difference between use and require regarding honoring prototype defined for sub? (prototype)
by stewart_lee (Novice) on Nov 21, 2012 at 17:27 UTC |