directory - How do I make a perl script run another perl script? -


i writing large perl script, needs utilize other existing perl scripts. problem main script needs reference many different scripts different folders. example main script contained in:

/perl/programs/io  

it may need run script stored in:

/perl/programs/tools  

note there other orthogonal folders besides tools need able access of them on fly.

currently got:

my $mynumber = '../tools/convert.pl bin2dec 1011'; 

in theory should move io directory enter appropriate tool directory , call convert.pl script while passing parameters.

all store string in single quotes $mynumber.

the similar question answer not work version of perl. line

use ipc::system::simple qw(system capture); 

throws errors. using system works, this:

my $mynumber = system($^x, "../tools/convert.pl", 'bin2dec', '1011'); 

i can use above without setting equal execute scripts return no value , sent arguments.

this seems easiest way need , entire programs folder can moved anywhere , still work no parent directories above programs used.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -