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 ...?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to pass array as a reference from one perl file to other
by moritz (Cardinal) on May 14, 2011 at 19:45 UTC | |
Re: How to pass array as a reference from one perl file to other
by PyrexKidd (Monk) on May 14, 2011 at 21:41 UTC | |
by Gangabass (Vicar) on May 15, 2011 at 09:07 UTC | |
by romy_mathew (Beadle) on May 15, 2011 at 16:01 UTC | |
by romy_mathew (Beadle) on May 15, 2011 at 19:52 UTC | |
Re: How to pass array as a reference from one perl file to other
by John M. Dlugosz (Monsignor) on May 15, 2011 at 04:46 UTC | |
by Anonymous Monk on May 15, 2011 at 15:52 UTC | |
by lidden (Curate) on May 15, 2011 at 20:06 UTC |
Back to
Seekers of Perl Wisdom