Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Is it possible to execute Perl script within another script?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 21-07-2009
Member
 
Join Date: Oct 2008
Posts: 93
Is it possible to execute Perl script within another script?
  

Hello friends,

I don't have any Idea with PERL programming. Actually I use to work with perl program execution so my question is may be simple but I am not good at writing the code. What I want to ask is it possible to call a perl script from within another script? I want to call a perl script into another please let me know if it is possible? Is it possible to execute it?

Thanks in advance.

Reply With Quote
  #2  
Old 21-07-2009
Member
 
Join Date: May 2008
Posts: 38
Re: Is it possible to execute Perl script within another script?

If you would like to make a call to, or reference, a Perl script from within a different Perl script, you can accomplish this a system(), exec() or the backtick operator to the path for Perl. For example:

Code:
system("/usr/bin/perl /path/to/my_script.pl ");
Or store output to array:

Code:
@myarray = `/usr/bin/perl mysecondperlscript.pl`;
source: http://theos.in/perl/how-can-i-call-...-from-another/
Reply With Quote
  #3  
Old 21-07-2009
Member
 
Join Date: Apr 2008
Posts: 60
Re: Is it possible to execute Perl script within another script?

Try this:

add.pl

Code:
my $sum = qx(perl addition.pl 10 -20); ## Remove double quotes from your code
print "Result is $sum";
addition.pl

Code:
$x, $y) = @ARGV;

if ( !defined($x) ) {
   print STDERR"usage add <x> <y>\n";
   exit;
}
else
{
$n = 0;
$n = $x + $y;
}

print $n;
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags:



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Is it possible to execute Perl script within another script?"
Thread Thread Starter Forum Replies Last Post
How to run Perl script on Mozilla Firefox? Grayson Software Development 5 02-11-2011 02:35 PM
Firefox problem with perl script Gajendra1 Software Development 6 09-09-2010 04:44 PM
How to call perl script from Python? Jhonwho Software Development 3 23-07-2009 09:59 PM
Need Perl script to execute from another. beelow Software Development 2 20-06-2009 09:17 AM
Title of a Perl CGI script !const Software Development 2 26-03-2009 11:43 PM


All times are GMT +5.5. The time now is 08:09 PM.