When you use require, the code in the file you specified will be executed immediately. Usually for what you want to do your code would be put into a subroutine, and you would use something like:require("counter.pl");
require("counter.pl"); insert_counter(); # can also pass arguments to this subroutine
where insert_counter() is the name of the subroutine you defined in counter.pl. You could then pass subroutine arguments to it like the name of referrer script, the database handle, etc.
For more info on subroutines, check out perldoc perlsub. When you need better encapsulation, you'll want to read up on how to create modules.
Update: forgot that perl doesn't have include, and that it instead uses require.
In reply to Re: How to call counter.pl script from another script
by pc88mxer
in thread How to call counter.pl script from another script
by Nik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |