RE: functions that returns two arrays

2005-01-03 Thread Tim Johnson
I think you're looking at this the wrong way. What you want is to fill two arrays with data from a function. This does not necessarily mean that you want the function to return two arrays (it can't actually be done, since the function will flatten them both out into one list when it returns them

Re: functions that returns two arrays

2005-01-03 Thread Alfred Vahau
Observe the use of the arrow (->) operator when dealing with references. This example adds two matrices. --- #!/usr/bin/perl @array1 = (1, 2, 3); @array2 = (4, 5, 6,7); AddArrays ([EMAIL PROTECTED], [EMAIL PROTECTED]); # Passing the array by reference print "@array1 \n"; sub AddArrays { my

Re: functions that returns two arrays

2005-01-03 Thread Alfred Vahau
return (@array1, @array2); This will result in list flattening. One big list. I read something about passing by reference Take references to the arrays. return (\array1,\array2) Perl comes with extensive online tutorials/documentation. but does not found anything on return by references. See perld

Re: functions that returns two arrays

2005-01-03 Thread Khairul Azmi
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, > >