[PERL] Include .pl file

I needed to use some function to include a .pl file as in C. The answer is: require

mainFile.pl

require "myFunc.pl";

betterPrint("test");

myFunc.pl

push @INC, \&betterPrint;

sub betterPrint {
...
}

Pay attention to what you require. The .pl file must be in the same directory or called through full path.

Annunci