Believe you want to do as a reference otherwise it justs returns the
data as a flat file or stream of data.
Here is a snippet. Would get away from a and b since the $a and $b are
used by sort. Know that it is an array, but would get away from that.
Also use strict and warnings.
#!perl
use strict;
use warnings;
sub TEST
{
my @c = ("a1","a2","a3","a4","a5","a6","a7");
my @d = ("b1","b2","b3","b4","b5","b6","b7");
return ([EMAIL PROTECTED], [EMAIL PROTECTED]);
}
my($lala,$baba) = TEST;
print @{$lala};
print "\n\nNext array:\n";
print @{$baba};
Output:
a1a2a3a4a5a6a7
Next array:
b1b2b3b4b5b6b7
If you have any problems or questions, please let me know.
Thanks.
Wags ;)
David R Wagner
Senior Programmer Analyst
FedEx Freight
1.408.323.4225x2224 TEL
1.408.323.4449 FAX
http://fedex.com/us
-----Original Message-----
From: Gallagher, Tim F (NE) [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 12, 2006 08:55
To: Perl Beginners
Subject: Subroutine returning 2 arrays
>From a subroutine I would like to return 2 separate arrays like this
sub TEST
{
@a = ("a1","a2","a3","a4","a5","a6","a7");
@b = ("b1","b2","b3","b4","b5","b6","b7");
return (@a, @b);
}
my(@lala,@baba) = TEST;
print @lala;
The problem is that @lala will return a1a2a3a4a5a6a7b1b2b3b4b5b6b7 and
@baba will return nothing. How can I return 2 arrays and have the info
look like this:
print @lala would return a1a2a3a4a5a6a7
print @baba would return b1b2b3b4b5b6b7
Thank you,
Tim
**********************************************************************
This message contains information that is confidential and proprietary to FedEx
Freight or its affiliates. It is intended only for the recipient named and for
the express purpose(s) described therein. Any other use is prohibited.
**********************************************************************
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>