in reply to splitting command-line arguments

I really appreciate everyone's help here but I'm clearly not being clear. That's my fault and I've already punnished my wicked flesh for wasting everyone's brain cells. Let me try being a bit more explicit...

I'm writing a cron daemon in Perl.

O.K. not really, but sort of. At this point most people should be ready to ask "Why would you want to do something like that?" and the answer is basically, they want to pay me for it (could be worse, they could want me to encode everything Encoding Script).

So, this cron daemon does everything serially so I don't need to worry about any time specifiers, I just have the programs to run in a text file (crontab sort of thing). An entry might look like.

"getStuff" configs --force=all --out out.txt -v -a
I'm going to want to pass this to system() at some point and I'm having a problem just passing in the complete line. I keep getting
'D:\Documents' is not recognized as an internal or external command, operable program or batch file.
Yes. Windows. I've punnished my flesh for that too.

Here is a simple example of what I want.

while (<DATA>) { chomp; s/#.*$//; #Clear out comments next unless $_ && $_ ne ''; m/^\s+\Q"\E(.+?)\Q"\E\s*(.*$)/; $task = $1; @args = split /\s+/, $2 if $2; for (my $i = 0; $i < $#args; $i++) { #Arguments begin with - or -- or + if ($args[$i] =~ /^[-\+]/) { #if this looks like an argument, and the next one # doesn't, prepend the next thing to this one. $args[$i] .= " " . $args[$i+1] if $args[$i+1] =~ /^[^-\+]/; #remove the thing from the args array. splice @args, $i+1, 1; } } system ($task, @args); }
This seems to work. Well the thing I snipped it from seems to work but I might have screwed it up pasting it in here.
I keep thinking that there is probably a better way of doing this, but I can't seem to come up with one.

If anyone has any suggestions...
Thanks,
Ira

"We demand rigidly defined areas of doubt and uncertainty!"
~Vroomfondel (Hitch Hickers Guide to the Galaxy)