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

Hi, I have one script which does some kind of add/edit/delete/copy text automation with multiple folder but using common file

I fear that one folder data is mixed with folder data as i m using common file for all folder. testing is quite tough due to huge size.

I am just eager to know if perl execute statement by statement and jump to other statement only when last one is over or it jump after firing last statement???

default perl execution parallel or serial?????

Update

Thanks for your notes. Let me give you one simple example.

I have many directories such as below;

1200 1201 1202 1203 1204 1205 .... ....

and one common file(common.txt) present in each directory. My script will do some add/edit/delete operation in each common.txt and make one new file called common_temp.txt under /tmp/ location.

and then copy same file to common_temp.DATE.txt to ONE location. I am not using any for loop..each directory operation is getting done based one config input file.

My worry is that while doing this operation, data from one from to another should not be mixed. i mean last execution is still running and new has been executed.... so wanted to know how perl executes..

Statement by statement or it just fires the statement n move to other statement

Replies are listed 'Best First'.
Re: default perl execution parallel or serial
by GrandFather (Saint) on Jan 02, 2012 at 06:42 UTC

    For any individual instance of a running script Perl executes statements serially so if you have only one copy of the script running there should be no problem.

    You could of course easily run multiple instances of the same script either on one computer, or even on several different computers that share access to the common file. If such a thing is possible there are many ways to manage access to your common file. Correctly handling multiple access to a common file can be very difficult though, depending somewhat on what you are actually trying to do. If you think it is possible that several copies of the script could be running at the same time you should describe what you are doing and seek further advice.

    True laziness is hard work
Re: default perl execution parallel or serial
by Marshall (Canon) on Jan 02, 2012 at 07:16 UTC
    I presume that by common "folder" you mean a common "directory"?

    I've heard this: "firing last statement" term recently, but that is not standard English terminology. I don't know that you mean by that.

    Can you explain what you are doing in multiple steps?

    The important part is who is reading or writing what file and what directory. If multiple programs are doing this, it gets complicated, but it is a solvable problem.

      "Firing last statement" means that the last statement they had wasn't doing its job, so they fired it and hired a new one.

        Oh no, it was the last statement. They fired it without replacement.
      Thanks for your notes. Let me give you one simple example. I have many directories such as below; 1200 1201 1202 1203 1204 1205 .... .... and one common file(common.txt) present in each directory. My script will do some add/edit/delete operation in each common.txt and make one new file called common_temp.txt under /tmp/ location. and then copy same file to common_temp.DATE.txt to ONE location. I am not using any for loop..each directory operation is getting done based one config input file. My worry is that while doing this operation, data from one from to another should not be mixed. i mean last execution is still running and new has been executed.... so wanted to know how perl executes.. Statement by statement or it just fires the statement n move to other statement
        Sounds like there may be a problem with this: My script will do some add/edit/delete operation in each common.txt and make one new file called common_temp.txt under /tmp/ location. Maybe there is another program updating this common.txt file at the same time that you are reading it?

        If you have one single Perl program running, it will just, like any other program language do one thing after another. Your terminology confuses me. What do you mean by: by the statement: or it just fires the statement n move to other statement?

        I don't understand this part about "fires the statement n". Please use different words to describe this.