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

I am working on a bunch of sequential processes (i.e. the output of one process is needed by the next one). Initially I had thought of writing a wrapper script what would call a bunch of scripts (one script per process). This rather modular approach would pass the command line arguments from the wrapper script to scripts called by the wrapper. However, I am now not sure a wrapper would be a good idea for this as opposed to a single script with each subprocess being a subroutine instead of a separate script. I am sure both approaches would work, but which one is more efficient and elegant if such a distinction can be made?

Replies are listed 'Best First'.
Re: wrapper vs subroutine
by chromatic (Archbishop) on Mar 11, 2001 at 09:24 UTC
    Write one script. With separate programs, you'll probably have the computer start an entirely new process and interpreter for each separate program. That's less efficient.

    If you're writing good routines that you're likely to reuse in the future, you could create a separate module to house those subroutines. That's the ultimate in reusability. See perldoc perlmod for more information.