Results 1 to 3 of 3

Thread: Is it possible to execute Perl script within another script?

  1. #1
    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.

  2. #2
    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/

  3. #3
    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;

Similar Threads

  1. How to run Perl script on Mozilla Firefox?
    By Grayson in forum Software Development
    Replies: 5
    Last Post: 02-11-2011, 02:35 PM
  2. Firefox problem with perl script
    By Gajendra1 in forum Software Development
    Replies: 6
    Last Post: 09-09-2010, 04:44 PM
  3. How to call perl script from Python?
    By Jhonwho in forum Software Development
    Replies: 3
    Last Post: 23-07-2009, 09:59 PM
  4. Need Perl script to execute from another.
    By beelow in forum Software Development
    Replies: 2
    Last Post: 20-06-2009, 09:17 AM
  5. Title of a Perl CGI script
    By !const in forum Software Development
    Replies: 2
    Last Post: 26-03-2009, 11:43 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,725,646.51050 seconds with 17 queries