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
In reply to Re: How to pass array as a reference from one perl file to other
by John M. Dlugosz
in thread How to pass array as a reference from one perl file to other
by romy_mathew
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |