passing arrays to subroutines 
Author Message
 passing arrays to subroutines

I would like to pass and return 2 arrays to a subroutine/function.
I have tried the following, but it doesn't seem to work. Have i got
it all wrong or am i on the right track?

sub do_something

   .....
   .....

Quote:
}

The easy answer is to make arrays global but i would prefer to avoid
global variables if possible.

Thanks for any assistance.
------------------------------------------------------------------------------

Technical Officer                       | Phone  : +61 7 223 4307
South East Queensland Electricity Board | Fax    : +61 7 221 7556
------------------------------------------------------------------------------



Thu, 01 May 1997 14:48:00 GMT  
 passing arrays to subroutines

:I would like to pass and return 2 arrays to a subroutine/function.
:I have tried the following, but it doesn't seem to work. Have i got
:it all wrong or am i on the right track?
:

:
:sub do_something

:   .....
:   .....

:}
:
:The easy answer is to make arrays global but i would prefer to avoid
:global variables if possible.

You're going to have to pass and return references.




    sub do_something



       .....
       .....
       return $a1, $a2;
    }

or maybe




--tom
--

        "EMACS belongs in <sys/errno.h>: Editor Too Big!" -me



Fri, 02 May 1997 12:31:11 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. passing arrays into subroutines

2. Passing arrays to subroutines

3. Passing arrays from subroutines.

4. Passing arrays to subroutines?

5. Passing arrays into subroutines

6. Q: passing array/hash from one subroutine to another subroutine

7. How to pass arrays to a subroutine?

8. passing an array inside a hash to a subroutine

9. passing a reference to an array to a subroutine

10. Help with subroutines and passing arrays

11. Passing an array of function names to a subroutine

12. Passing arrays to a subroutine

 

 
Powered by phpBB® Forum Software