1

I'm trying to call perl1.pl which is in another folder with switches from another perl script say perl2.pl. Usually perl1 is called like:

perl1.pl -arg $arg1 -arg2 $arg2

Now the problem is $arg1 gets generated internally from program perl2 and $arg2 is obtained from the switch when perl2 is executed like this.

perl2 -arg2 $arg2.

I tried using system command to call perl1.pl but it isn't working. Is there any way to do this? There are also few arguments in perl1 which accepts from the user which are always required. I'm not sure how to send them.

1
  • "isn't working" isn't helping finding a solution. Commented Feb 25, 2014 at 6:13

2 Answers 2

1

Some example would be usefull. You could use backticks to capture the output of an executable.

### in perl1
my $ret = `$perl2 -arg2 $arg2`;
chomp($ret);
print "ret: $ret\n";
Sign up to request clarification or add additional context in comments.

Comments

0

You can use CPAN module IPC::System::Simpleto capture the output. For more details have a look here : IPC::System::Simple

my $output = capture("some_command", @args);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.