rafalwoycicki has asked for the wisdom of the Perl Monks concerning the following question:

Dear all, I am new in Perl. I have a problem with my perl script which is analyzing a lot of text data and after something like 500 analyzed text files I see that a lot of additional same perl scripts are being started and running. It is a problem because they double the work and everything works slower. What could be the problem and how can I repair that problem?

Replies are listed 'Best First'.
Re: Unwanted instances of perl script
by kennethk (Abbot) on Feb 23, 2009 at 18:36 UTC

    You aren't really providing us with enough information to diagnose your problem - please see How (Not) To Ask A Question. In particular, we probably need to see your code.

    My best guess is that your script is creating threads or forking and not managing the children properly. You may get some insight from perlthrtut.

Re: Unwanted instances of perl script
by ELISHEVA (Prior) on Feb 23, 2009 at 18:38 UTC
    It is hard to help without a more precise idea of your code. Could you trim down your script to its essentials and add it to your post like this:
    <readmore><code> ... put your code here ... </code></readmore>

    Best, beth

Re: Unwanted instances of perl script
by bichonfrise74 (Vicar) on Feb 23, 2009 at 19:00 UTC
    If you are using Linux, you can run a ps aux | grep <perl script> to see if it is currently running.

    Now, everytime you run your script, do a check on this and make sure that the older process is finished before create a new one.