Greetings!

I have a class that contains a member that is an array.  I have a
method of the class that gets me a reference to the array.  I can print
out the contents of the array.  But I can't find out how many items are
in it!  What is going on here?  There's something simple I'm missing.

Here's the code that retrieves the reference to the array, with a bunch
of print statements in it to try to figure out if I know what I'm doing
or not:

sub GetCrewList
{
        my $self = shift;
        print "Getting crew list<br>";
        my $crewListRef = $self->{'crew'};
        my @crewArray = @$crewListRef;
        print "Crew: @$crewListRef<br>";
        print "CrewArray: @crewArray<br>";
        my $crewArrayCount = scalar(@crewArray);
        my $crewCount = $#crewArray;
        print "Crew count: $crewCount<br>";
        print "Crew array count: $crewArrayCount";
        return $self->{'crew'};
}

Here's the output of the print statements:

Getting crew list
Crew: 2.14.2003,Wine Train - BX,17:00,Person 1,Person 2,Person 3,Person
4,Person 5,Person 6,Person 7,Person 8,Person 9,Person 10,Person
11,Person 12,Person 13,Person 14 
CrewArray: 2.14.2003,Wine Train - BX,17:00,Person 1,Person 2,Person
3,Person 4,Person 5,Person 6,Person 7,Person 8,Person 9,Person
10,Person 11,Person 12,Person 13,Person 14 
Crew count: 0
Crew array count: 1The first train has 1 crewpeople.
The local array has 1 people.

The only thing I can think of is that maybe I have managed to create an
array that contains only one thing, a reference to another array.  But
then the "print @crewListRef" statement wouldn't have had valid syntax,
would it?

RobR, completely mystified.


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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

Reply via email to