in reply to splitting command-line arguments
getStuff
configs
--force=all
--out out.txt
-v
-a
getOtherStuff
configs
--force=all
--out out2.txt
-v
-a
By separating each argument with a newline, you remove the need to write code to guess how the target program parses its arguments. You may now use <>'s paragraph mode to parse the arguments into an array:
$/ = ""; $" = ", "; while (<FH>) { my @args = split /\n/, $_; print "args: @args\n"; }
prints:
args: getStuff, configs, --force=all, --out out.txt, -v, -a
args: getOtherStuff, configs, --force=all, --out out2.txt, -v
|
|---|