|There's more than one way to do things|
Bravo. That is precisely what I think dragonchild was trying to suggest without spelling it out explicitly (as in: "if I think it through fer ye, ya won't learn nuthin'").
It's how I interpreted the original question as I read it, as well.
There seems to sometimes be a tendency amongst (us) developers/programmers/technocrats to overcomplicate, at least in my case, in the sense that the obvious can be overlooked in favor of a literal interpretation that misses the point. Being guilty of the same, however, does not preclude being able to detect when it happens to someone else. Nay, it can make it stand out sometimes (we must all remember "it takes one to know one" from childhood).
It seems to me that asking some questions implies a need for understanding of the realm that the answers might take, and lacking that understanding, the question may understandably suggest to an otherwise knowledgable individual, an unintended specificity that is not actually there.
In this case, the original poster snafu seems (to me) to be asking how to write a block of code in such a way that it may be used as a module (e.g., using user by a larger program and also standalone. The answer as I would deliver it is that it should be written as a module, with an entry point (sub) written to accept what might be command-line arguments. Then, a trivial command-line script (i.e., shell) could be written in several lines which simply loads the module and passes its comand-line arguments directly into the sub, without manipulating them.
My .02 ...
In reply to Re: Possible to have a module act as a standalone??