develooper Front page | perl.beginners | Postings from February 2002

Return multiple arrays

Thread Next
Mike Garner
February 5, 2002 07:52
Return multiple arrays
Message ID:
I'm going back through some old code and trying to clean things up, apply 
new tricks, and make sure everything is running in strict mode.  Doing this 
I have encountered a problem.  I have a subroutine that calls another 
subroutine, passing one array to the second for processing.  I need the 
second sub to return 3 arrays to the first sub.  I can't seem to get this 
to work....well I can return the data from all three subs, but it returns 
into one array.  Is there an option to do this or do I need to rewrite the 
second subroutine into 3 smaller subs? or maybe I'm not using my 
correctly...running without use strict; and not using my on the arrays 
makes them global and avaiable for processing by the first sub...but I want 
to use strict;

sub sub1 {
   my (@array1,@array2,@array3,@array4);

sub sub2 {
   do three processes with @array5 and store results in arrays 6-8;

Mike Garner
Western State College
Voice: 970-943-3123
Fax: 970-943-7069

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About