Hey Guys,

Have u any Idea how to call a perl script within my main script in a loop.
I used system and exec both, but it seems to be not working. I want the second calling of the script shouldn't depend on the first calling.... all should run independently............

Recommended Answers

All 5 Replies

you can try this: open the file, slurp it all in at once and use eval to execute the code.

Calling another perl script in a loop should not be difficult but the last part of your question makes no sense to me.

I want the second calling of the script shouldn't depend on the first calling.... all should run independently............

I am calling the script as exec(called_script.pl, arg1), its calling first time , second execution is not going, it is killing the main process. My second question refers all the time loop increases it should run another instance of the script. Ok can u just tell how to call the script in a loop. Thanks in advance

I guess you didn't read what exec() does.

The exec function executes a system command and never returns-- use system instead of exec if you want it to return

http://perldoc.perl.org/functions/exec.html

As they say on forums: Read the manual

If you want to run multiple instances of a perl program I think you will want to use threads. Not something I have experience with though:

http://search.cpan.org/~jdhedden/threads-1.74/threads.pm

Member Avatar for onaclov2000

I know i've used print `command`; as well with varied success.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.