Can't declare reference constructor in "my" at array.pl line 10, near ")=" Execution of array.pl aborted due to compilation errors.
On Tue, 4 Jan 2005 09:42:55 +0800, Renqilong <[EMAIL PROTECTED]> wrote: > On Tue, 4 Jan 2005 09:21:43 +0800 > Khairul Azmi <[EMAIL PROTECTED]> wrote: > > > 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); > ====> return ([EMAIL PROTECTED],[EMAIL PROTECTED]); > > } > > > > my (@out1,@out2)=func(); > ====> my ([EMAIL PROTECTED],[EMAIL PROTECTED]) = 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> > > > > > > > > -- > Whatever you do will be insignificant,but > the important is you do it! > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>