The following module was proposed for inclusion in the Module List:
modid: Data::TableAutoSum DSLIP: bdpOp description: Tables with automatic col/row/total sums userid: BIGJ (Janek Schleicher) chapterid: 6 (Data_Type_Utilities) communities: similar: Data::Pivot Data::Pivoter Data::Xtab rationale: I first proposed this module with the name Data::CrossTable. Following a suggestion of Tim Bunce, I renamed it to Data::TableAutoSum. This modules handles of tables with automatic generated col/row/total sums. Setting the values into the tables will force to recalculate the sums. That is e.g. used when generating statistical reports. Of course, you can use any associative, distributive operation instead of sum (e.g. multiplication makes sense when working with probabilities). Let's think e.g. to a population count. Let's say we want to create a table showing the population in the U.S.A. regarding to the towns 'New York', 'Chicago', 'L.A.', 'San Francisco', 'Houston' and the sex 'female', 'male'. Let's think I've got a big file with information of the population, e.g. the phone books. Then I'd like to write a pseudocode like my @towns = ('New York', 'Chicago', 'L.A.', 'San Francisco', 'Houston'); my @sex = qw/female male/; my $population = Data::CrossTable->new(rows => \@sex, cols => \@towns); while (<FILE>) { my ($town, $sex) = /...../; $population->data($sex,$town)++; } where the populations of each town, each sex and the total population are updated in the background. Finally we could say, e.g. there are population->rowresult('female') women in the big cities. Furthermore I'd like to calculate with the CrossTables. E.g. the percentuage of inhabitants could be calculated with: my $perc_population = $population / $population->totalresult(); or if we would like to have the more readable 12% reading than the 0.12, we could write something like my $perc100_population = $perc_population->change( sub { $_ *= 100 } ); Another way is that we have built the tax payings for the big cities. Then we could write my $tax_per_inhabitent = $tax_per_city_and_sex / $population; enteredby: BIGJ (Janek Schleicher) enteredon: Thu Jul 25 06:01:02 2002 GMT The resulting entry would be: Data:: ::TableAutoSum bdpOp Tables with automatic col/row/total sums BIGJ Thanks for registering, The Pause Team PS: The following links are only valid for module list maintainers: Registration form with editing capabilities: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=38100000_0c54e2bb24da1d25&SUBMIT_pause99_add_mod_preview=1 Immediate (one click) registration: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=38100000_0c54e2bb24da1d25&SUBMIT_pause99_add_mod_insertit=1