Hi,
I am new with PERL programming.
I have a question. Is it possible to call a Perl script from an another script. The problem is how to get a response from the script?
Any help will be appreciated.
Hi,
I am new with PERL programming.
I have a question. Is it possible to call a Perl script from an another script. The problem is how to get a response from the script?
Any help will be appreciated.
This will call a new perl process, and may be more expensive on the
Code:system. On the other hand I can doProbably the dimpliest way is to make called script a module and run itCode:But How do I get the response of the script.
using either 'use' or 'require'.
If you care about speed, consider using do 'filename.pl', which will avoid firing up a new Perl interpreter.
I think you can do the following;
1. backticks: $retVal = `perl somePerlScript.pl `;
2. system() call
3. eval
The eval can be accomplished by slurping the other file into a string (or a list of strings), then 'eval'ing the strings
4. do:Code:#!/usr/bin/perl open PERLFILE, "<somePerlScript.pl"; undef $/; # this allows me to slurp the file, ignoring newlines my $program = <PERLFILE>; eval $program;
For more discussion.Code:do 'somePerlScript.pl'
Bookmarks