in reply to Re^2: Passing array pointer through script input
in thread Passing array pointer through script input

Sounds like premature optimization. If the work you are doing per file is significant then the minor overhead of reading a list from a small file is trivial.

It may be worth using something like DBM::Deep to store the list of files to be processed however to make management of the list easier and perhaps faster.


Perl reduces RSI - it saves typing
  • Comment on Re^3: Passing array pointer through script input

Replies are listed 'Best First'.
Re^4: Passing array pointer through script input
by vit (Friar) on Aug 20, 2008 at 23:06 UTC
    The file has a special structure with addressing which allows a quick regection and that's why reading is a bottleneck not processing. Processing is much faster.
    I do not want to change this part and therefore I do not think I can use DBM::Deep.
    So actually the question is if it's possible to effectively pass arrays to called scripts. Join to a long string with /\n/ separator and then split inside...? Or how?

      You would be much better to turn myscript.pl into a module and call into it directly. There is likely to be at least as much overhead running myscript.pl in that fashion is there would be in passing your list through a file. Turning myscript.pl into a module avoids both costs and allows beter integration between the two pieces of code.


      Perl reduces RSI - it saves typing
        Yes, it's possible but I do not want to do redesigning.
        I think if I pass a long string as input stream and split it inside it should be OK because it's all done in RAM and should be much faster then reading files from disk.
        What do you think?
      Maybe old-school piping via STDOUT/STDIN (see IPC::Open2) is something for you if you can write/retrieve the arrays line by line?