#!perl
use strict;
use CGI qw/:standard/;;
require "my_subs.pl";print header;
my $digits = param('digits') ¦¦ 100;
my $incremented = add($digits);
print $incremented;
my_subs.pl (in same folder as main.pl)
use strict;
sub add {
my $number = shift;
$number++;
return($number);
}
1;
note the last line of my_subs.pl, this is important as required files have to return a true value when first called with "require".
You can use the "do" function (not really a function but I don't know what it's called), but in the "do" documentation it says:
Note that inclusion of library modules is better done with the use() and require() operators, which also do automatic error checking and raise an exception if there's a problem.
Note: the ¦¦ is supposed to be the pipe character which is on the same key as the back-slash charater \ , this forum changes it for some reason.
BEGIN { require Module; import Module LIST; }
except that Module must be a bareword.
for all the dirty details:
[perldoc.perl.org...]