> I'd like to create a numerically indexed associtative array, each key
will
> contain an array of three elements like:
>
> $array[0] = ("element0", "element1", "element2");
> $array[1] = ("element0", "element1", "element2");
> $array[3] = ("element0", "element1", "element2");
> etc.
>>Why use an associatative array if your indexing with integers? Just use
an
>>array of arrays.
>>$array[0] = ['element0','element1','elmement2'];
>>...
True.
>>Foreach my $list ( @array ) {
>> Foreach ( @{$list} ) {
>> Print "$_";
>> }
>>}
>>Prints
>>...
>>Element0
>>Element1
>>Element2
>>Element0
>>Element1
>>Element2 ...
>>What are you trying to do? If you give us a better idea of where your
going
>>with this we can give you better advice.
First i'm trying get get nomenclature and syntax down...they i'll
worry about the acutal task :).
> In a For Loop, I'm trying to build the array like:
> %errors[$i] = ($1,$2,$3);
>
> is this correct/good practice?
>>Try push (@errors, [$1,$2,$4]);
excellent
> When this completes, i do have an array, with a size of 60...but i can't
> figure out how to loop through it.
>>Foreach my $list (@errors){
>> print "$list->[0] $list->[1] $list->[2]\n";
>>}
>>Or
>>foreach my $list ( @errors ){
>>Foreach ( @{$list} ) {
>>Print "$_\n";
>>}
>>}
>>Untested and outlook slaughter the caps.
> I've seen many array tutorials, but none of them, that i've found so
far,
> get into arrays like the above, so i assume i'm going about it wrong, or
> looking in the wrong place.
>>Quit looking at hashes/associative arrays when you are going to index
with
>>an incremental integer. You just using an array that is dressed like a
hash
>>:)
Good Point...i won't.
> Thanks for any help you may be able to give. It's going to take my a
> while
> to remember everything that i've forgotten...
HTH,
Paul
It does help.
Thanks Paul. and thanks for the perldoc perllol hint....that is exactly
what i'm looking for.
Jeff
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>