I believe the logic in your for loop is incorrect, beside kabel's point about wrecking your hash by assigning to it after the loop, the while loop inside the for simply ends up assigning each line of the file to the hash 10 times
foreach my $line (@record) { ($timestamp, $current_time, $funds, $action, $current_funds) = split " +\t",$line; # The values of $timestamp, $current_time, $funds, $action, $current_f +unds never change in this while loop. while ($count < 10){ $member{$timestamp} = [$current_time, $funds, $action, $current_fu +nds]; $count += 1; } }
You want something like this:
for my $line (@record[0..9]) { ($timestamp, $current_time, $funds, $action, $current_funds) = split + "\t",$line; $member{$timestamp} = [$current_time, $funds, $action, $current_fund +s]; }
HTH
In reply to Re: Making a hash of making a hash of an array
by pzbagel
in thread Making a hash of making a hash of an array
by jonnyfolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |