Hi,
What I have is the following working but would like to take it one step further.
open (DB, "<$db_file_name") or &cgierr("error in count. unable to open database: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB,1); }
@lines = <DB>;
close DB;
foreach $line (@lines) {
chomp ($line);
@data = &split_decode($line);
++$count{$data[4]}; # Week of the year
++$count{$data[7]}; # Planned Duration eg 4 hrs
$total8 += {$data[8]}; # Actual Duration eg 5 hrs
++$total_count;
}
This works fine and give a result like
31:1:0
32:1:0
33:2:0
What I'm trying to do is get the above to give the total value of $data[8]
31:1:4
32:1:5
33:2:10 # found two record for week 33 and the total value for $data[8] = 10 (5+5)
Hope this make sence in wait I'm try to achieve.
What I have is the following working but would like to take it one step further.
open (DB, "<$db_file_name") or &cgierr("error in count. unable to open database: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB,1); }
@lines = <DB>;
close DB;
foreach $line (@lines) {
chomp ($line);
@data = &split_decode($line);
++$count{$data[4]}; # Week of the year
++$count{$data[7]}; # Planned Duration eg 4 hrs
$total8 += {$data[8]}; # Actual Duration eg 5 hrs
++$total_count;
}
This works fine and give a result like
31:1:0
32:1:0
33:2:0
What I'm trying to do is get the above to give the total value of $data[8]
31:1:4
32:1:5
33:2:10 # found two record for week 33 and the total value for $data[8] = 10 (5+5)
Hope this make sence in wait I'm try to achieve.