Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing array from one perl script to another perl script 1

Status
Not open for further replies.

dmazzini

Programmer
Jan 20, 2004
480
US
Hi expert

I want to pass one array from one perl script to another perl script.

I don't have problems passing variables. My problem is with the array.

What I am doing:

In the ScriptName 1 :

I am processing some things, but at the end I need to invoke the scriptname 2 and pass some values...

system(scriptname2.pl @array $var1 $var2 $var3 $var4 $var5);


In the ScriptName 2 :
Getting the values from the ScriptName 1

@array = $ARGV[0];
$var1 =$ARGV[1];
$var2 =$ARGV[2];
$var3 = $ARGV[3];
$$var4 =$ARGV[4];
$var5 =$ARGV[5];


Error Found:
Scalar found where operator expected

-------------------------------------------------------

Somebody can help me with that! I was checking references, but to be honest I don't know how to apply it to that particular case...It applies easily parsing arrays to another function, like the nex example:


@array1 = qw/1 2 3/;
@array2 = qw/4 5 6/;

puke( \@array1, \@array2 ); #outputs 123,456

sub puke {
my ($array_ref1, $array_ref2) = @_;
print "$_" foreach @{$array_ref1};
print ",";
print "$_" foreach @{$array_ref2};
}

Thanks!



 
Me, personally, I, think you guys aren't looking at the problem right.

1) Define problem
2) Scope issues
3) Code up & test
4) Charge Client, or ask for help, step to 3) [reiterate if needed]
5) Charge Client
Else --> New Thread

Parts 3 & 4 we can answer, pissing contests we can't ...

--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
fully agree with you, particularly $teps 4 & 5.
i accept cash, charge & barter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top