Hi,
I'm trying to write a function that could return two arrays.

sub func {
  my @array1=(1,2,3,4); 
  my @array2=(a,b,c,d);

  return (@array1, @array2);
}

my (@out1,@out2)=func();
for (my $i=0;$i<@out1;$i++) {
     print "$out1[$i]";
}
print "\n";
for (my $i=0;$i<@out2;$i++) {
     print "$out2[$i]";
}
print "\n";

The program would store everything onto @out1 and leave nothing to @out2
1234abcd

I read something about passing by reference but does not found
anything on return by references.
Help please. Thanks in advance.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to