So all i want to do is pass a an array to a function (or subroutine) in PERL
So @Temp
contains 2 arrays
[0] = {xx,xx,xx,xx,xx}
[1] = {xx,xx,xx,xx,xx}
#returns array containing two arrays
my @temp = $lineParser->parseLine($_);
@handOne = $cardFactory->createHand(@Temp[0]);
@handTwo = $cardFactory->createHand(@Temp[1]);
This is the createHand method wich is contained in a seperate class (or package or whatever)
sub createHand
{
my $self = shift;
my @temp = @_;
my @arrayOfCards;
foreach(@temp)
{
my $value = substr($_,0,1);
my $color = substr($_,1,1);
push(@arrayOfCards,new Card($value,$color));
}
return @arrayOfCards;
}
The problem i am having is that the array gets passed but is contains ARRAY(XXXXX)
at the start of the array.
E.g. {0 ARRAY(xxxxxx), 0 'xx', 1 'xx', ...}
Why does this happen?
How can I manage to do this correctly?