in reply to Re^6: Passing array pointer through script input
in thread Passing array pointer through script input
I think the overhead of starting up a new instance of the Perl interpreter, opening and reading myscript.pl's source, parsing it and finally executing the compiled code is likely to be much more expensive than opening a small file and parsing it line by line to extract file names. Fiddling about with serializing an array, passing it on the command line then deserializing it on the other side is about as much work as changing your myscript.pl to a module.
To turn myscript.pl into a module you need only add package MyScript; at the top, wrap the main code in a sub and add 1; at the end. With the main block as a sub the command line processing code turns into my (param list) = @_;. Where's the problem?
|
|---|