![]() |
|
Just another Perl shrine | |
PerlMonks |
How to pass array as a reference from one perl file to otherby romy_mathew (Beadle) |
on May 14, 2011 at 19:03 UTC ( #904871=perlquestion: print w/replies, xml ) | Need Help?? |
romy_mathew has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I am new in perl, was wondering how i can pass array reference from one perl file to other, I am able to pass complete array from one file to other sucessfully but when i pass the array reference it fails
E.g.
I am passing array from test-1.pl to test-2.pl
#test-1.pl my @array = (1,2,3,4,5); my $test = \@array; open (FILE, "| ./test-2.pl"); print FILE "$test"; close (FILE); #...............close...........
#test-2.pl
foreach (<>) { $temp = $_; } print "array = @$temp"; #.................. close............
Error : "Can't use string ("ARRAY(0x26158c0)") as an ARRAY ref while "strict refs" in use" Any suggestion ...?
Back to
Seekers of Perl Wisdom
|
|