Inventor wrote:
Hi,
Thanks for helping with my question the other day, now I have
another. In my class I have an array of hashes and it seems to work
just fine. I use the zeroth element to store individual variables and
all the other elements to store variables that change over time. For
example, i have the variable $num_games stuffed in $self->[0]
{'num_games'}, and then I have $w in each of the remaining array
elements like this: $self[1]{'w'}...$self[1489]{'w'}.
I think that's all working right, but now I would like to put an array
@teams into the zeroth element of $self and it isn't working. I
tried:
$self->[0]{'teams'} = @teams;
$self->[0]{'teams'} = [ @teams ];
and
@self->[0]{'teams'} = @teams;
but when I try to access the array with
foreach $team ($self->[0]{'teams'}) {
foreach $team ( @{ $self->[0]{'teams'} } ) {
print $team.' ';
}
or
print "@{$self->[0]{teams}}\n";
or
foreach $team (@self->[0]('teams')) {
print $team.' ':
}
i get nothing printed. I know the array is full because I can print
@teams to see the contents of @teams. What should I do? Thanks in
advance.
--
Just my 0.00000002 million dollars worth,
Shawn
"For the things we have to learn before we can do them, we learn by
doing them."
Aristotle
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/