perl: run another script without exec/system -


is possible include/source perl script, or launch "sub"? works, looks ugly:

test2.pl:

print "i'm in test2.pl; args: @argv\n"; 

test.pl:

#!/usr/bin/perl  use file::temp qw/tempdir/; use file::copy qw/copy/;  $tmplib;  use lib ($tmplib = tempdir()) . (   copy("./test2.pl", "$tmplib/test2.pm") ? "" : (die "$!")   );  use test2; 

x

$ ./test.pl b c i'm in test2.pl; args: b c 

it sounds want do operator, although sounds bad design.

this documentation says.

do expr uses value of expr filename , executes contents         of file perl script. 
            'stat.pl';                       eval `cat stat.pl`; 

Comments