Issue in executing more than one perl script from Single perl script

  • Thread starter nilesh.sonawane
  • Start date
N

nilesh.sonawane

Hi,
I am calling "1.pl" from "main.pl" file.
using
#main.pl
system ("perl 1.pl");

In this case it works fine.

But when I am doing
#main.pl
system ("perl 1.pl");
system ("perl 2.pl");

then it doesn't executes "1.pl" properly.
So I would like to know, is there any constraint for this? Do I need
to take any precautions for this?

Thanks,
 
T

Tad McClellan

But when I am doing
#main.pl
system ("perl 1.pl");
system ("perl 2.pl");

then it doesn't executes "1.pl" properly.


You need to provide some symptoms if you hope for a diagnosis.

How do you know that it did not execute properly?

What did you observe?

Were any messages issued?

....
 
J

Jim.Lane

Hi,
I am calling "1.pl" from "main.pl" file.
using
#main.pl
system ("perl 1.pl");

In this case it works fine.

But when I am doing
#main.pl
system ("perl 1.pl");
system ("perl 2.pl");

then it doesn't executes "1.pl" properly.
So I would like to know, is there any constraint for this? Do I need
to take any precautions for this?

Thanks,

Why are you using system() for this? AFAIK it forks a
whole new process - a lot of overhead to go to.
Isn't this what the "require" facility is for?

FWIW

Jim Lane
 
J

Josef Moellers

Why are you using system() for this? AFAIK it forks a
whole new process - a lot of overhead to go to.
Isn't this what the "require" facility is for?

Using system, you start a completely new program which executes on its
own, in its own context and e.g. is not required to be a Perl program at
all.

OTOH "require" will include the Perl program code into the current
program code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top