I'm trying to call a Java program from a Perl script. The java program is kept in a .jar file, and requires that several arguments are specified. Part of the challenge is that the arguments themselves are complex, multi-word items with spaces that when called from a bash shell, are surrounded by quotation marks. On a bash command line, it would look like this:
adolbey$ java -jar MyProgram.jar work.db "foo 5 bar == baz" "alpha 10 beta == gamma"
So the question for me is how can I call this from a Perl script, and do so in a way that groups together the multi-item arguments? I've seen examples where within the Perl call, the whole thing is just 'java programName arg1 arg2', and is done simply, with something like this:
system("programName arg1 arg2");
In a case like this, arg1 and arg2 are single tokens, and don't need to be grouped together with quotation marks. But in the case I'm trying to do, several of the args consist of multiple pieces that need to somehow be kept together. How would I do this in the context of using 'system()'?
Any help with this would be greatly appreciated.