in reply to Re: adding number to array name
in thread adding number to array name

Sorry if I misunderstood the orginal post.
From the orginal post, if count is less than 998 value will be added to @store_get_dist1, @store_get_dist2 and @store_get_dist3.
If the count is less than 1998 and greater than or equal to 998, the value will be addded to both @store_get_dist2 and @store_get_dist3.
At the time when the count is 1998, there should be 997 elements in @store_get_dist1 and 1997 elements in @store_get_dist2.
In your array of array implementation, When I add
print scalar(@{$store_get_dist[1]});
it prints 997 and prints 1000 for index 2. Not sure if this is the expected behaviour.
It should have been 997 and 1997 respectively. Am I missing anything?

Update:
From
push(@{$store_get_dist[$test_num]},$new);
to
for ($test_num.. int((($#all_stores+3)/1000)+1)) { #3 to account for 998 1998 and 2998 push(@{$store_get_dist[$_]},$new); }
and it should work. A quick dirty hack though.

Replies are listed 'Best First'.
Re^3: adding number to array name
by GrandFather (Saint) on Aug 24, 2006 at 08:18 UTC

    The behaviour implied by the original code is sufficiently odd that I assumed that it was in error rather than by design, especially in light of some of the other things that clearly were errors such as the additions in void context.

    It seemed much more likely that the data was intended to be partitioned into different groups than that groups with replicated information were required.


    DWIM is Perl's answer to Gödel