Without knowing the whole situation it's a bit hard to follow all of this, but here's my take. After reading
your previous post, it strikes me that maybe you can make a controlling program in perl which gathers and stores the data that needs storing and then the shell scripts based on their output. Again, not knowing the whole scope of the issues it's hard to say if that would work, but in case you hadn't explored that possability it may help. I figure if it worked as a shell script but needed more, maybe perl can just provide the more and leave what worked within the performance parameters you need already alone.
We speak the way we breathe. --Fugazi