"T.S.Ravi Shankar" <[EMAIL PROTECTED]> wrote:
Hi all :

How could I return more than 1 array or hash from a sub routine &
collect them in different arrays or hashes in the calling program ??

Return references to the arrays. Here's an example:


sub demosub {
   my @array1 = 1..10;
   my @array2 = 'a'..'f';
   return [EMAIL PROTECTED], [EMAIL PROTECTED];
}

my ($aref1, $aref2) = demosub();
print join(', ', @$aref1), "\n",  join(', ', @$aref2), "\n";


See 'perldoc perlref' for considerably more information about references.





-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to