in reply to How to pass array as a reference from one perl file to other
But maybe the example is easier than the real problem? If it's an existing program or a real mess and you can't alter it, you need some kind if Inter-Process Communication. But if you can't alter the existing program, you can't make it do that... so how is program 2 expecting the data already? Maybe you simply wanted to pass the contents of the array as individual arguments.
But you are also using the pipe-to form, so will program 2 be reading from standard input?
Without the pipe behavior, you can write:
And have test-2 see the values as the contents of @ARGV.system ("./test-2.pl", @$test);
If you really do want to pass the data via standard input and the pipe, then your print statement would be: print FILE (join "\n",@$test); that is, write the contents of the array one value per line, which is how your existing test-2 is reading it.
Edited for correction
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to pass array as a reference from one perl file to other
by Anonymous Monk on May 15, 2011 at 15:52 UTC | |
|
Re^2: How to pass array as a reference from one perl file to other
by lidden (Curate) on May 15, 2011 at 20:06 UTC |