Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8041735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:19:15+00:00 2026-06-05T04:19:15+00:00

I have a perl script that calls an other perl script by using system()

  • 0

I have a perl script that calls an other perl script by using system()

it’s like:

my $returnval= system("perl", $path,$val1, $val2,@myarray);

Because system() returns only the exit status but I want the script’s output I want to use backticks.

I tried something like that:

my $returnval = `$path`;

how can I add the parameters the script should receive?

how should the other perl script’s return code looks like? At the moment it’s like

exit ($myreturnedvalue);

(how) Is it possible to return multiple values?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:19:17+00:00Added an answer on June 5, 2026 at 4:19 am

    To go through the shell in order to move data from one perl script to another is not the best solution. You should know that backticks or qx() captures whatever is printed to STDOUT. Using exit ($var) from the other script is unlikely to be captured properly. You would need print $var. But don’t do that.

    Instead, make the other script into a module and use the subroutine directly. This is a simplistic example:

    In bar.pm:

    use strict;
    use warnings;
    
    package bar;  # declare our package
    
    sub fooz {             # <--- Our target subroutine
        my $in = shift;    # passing the input
        return $in * 5;    # return value
    }
    1; # return value must be true
    

    In main.pl:

    use strict;
    use warnings;
    use bar;   # bar.pm must be in one path in @INC
    
    my $foo = bar::fooz(12);  # calling fooz from our other perl script
    print "Foo is $foo\n";
    

    There is a lot more to learn, and I suggest you read up on the documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Perl/POE/Tk script running on Win32 ActivePerl that calls executables using system
I have a Perl script that I'd like to run on Windows, using either
I have a Perl script which invokes other programs, i.e. it calls system and/or
I have a Perl script that contains this code snippet, which calls the system
I have a system call in Perl that looks like this: system('/path/to/utility >> /redirect/to/log
I have a Perl script that is calling a program on Windows using backticks.
I have a perl script that's reading an INI file like this: [placeholder_title] Hostname
I'm writing a Perl script that makes system calls to kill running processes. For
I have a perl script using CGI. The browser calls it with some parameters.
I have matlab function that calls a Perl script which converts a large text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.