How to pass Arrays

A

amerar

Hi All,

I have a unix script which puts together an array:

set -A week_fnames $FILE5 $FILE6 $FILE7 $FILE8 $FILE9 $FILEA

How to I pass that array to a Perl program, and be able to use the
array in the Perl program??

Thanks!
 
B

Ben Morrow

Quoth "[email protected] said:
I have a unix script which puts together an array:

set -A week_fnames $FILE5 $FILE6 $FILE7 $FILE8 $FILE9 $FILEA

How to I pass that array to a Perl program, and be able to use the
array in the Perl program??

perl script "$week_fnames[@]" (or whatever the appropriate syntax is for
your shell) will pass the values into @ARGV in your perl program, but I
presume you could work that out... If you are trying to have your Perl
program change the values of the array in a shell script that invokes
it, then in general that can't be done. One way round is to have perl
emit shell code which you can then eval, but it can be tricky getting
the quoting right.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,206
Messages
2,571,069
Members
47,678
Latest member
Aniruddha Das

Latest Threads

Top