in reply to Not able to execute perl sub routine
if &sub is looking old style to many monks (not me, and is quite good if you do not use prototypes at all and if if you are aware that ⊂ will call &sub(@_); behind the scenes), what is looking very weird is the ancient require "file.pl"; style.
Code to be required and it's contained subs must go in modules and modules must be used via use
A simple module is more flexible than a required file, is easier to be tested.
Perl Modules are described in perlmod
PS: many simple module implementations can profit of the Exporter one to pull subroutines into the namespace.
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Not able to execute perl sub routine
by Laurent_R (Canon) on Dec 03, 2016 at 22:12 UTC |