I'm looking for a data-structure with these attributes:
It behaves like a multidimensional hash, so you can store / get data like this:
$sales(region=>'north', date=>'1-1-99', type=>'gross', channel=>'web')
It checks its dimensions (all valid values provided at creation), so
$sales(region=>'bogus-region', date=>'1-1-99', type=>'gross', channel=>'web')
would fail (bad region), as would $sales(region=>'south', date=>'1-4-99', type=>'gross')
(missing channel)
It provides for dimensional 'reductions' like this:
my $reduced = $sales->reduce([qw(region date)], \&mysum),
which would yield a new reduced object with data summed over region and date (eg the reduced object would have dimensions of type and channel)
It provides for dimensional 'transforms', such as
my $reduced = $sales->transform([qw(date)], \&mynormalize),
which would yield a new object normalized (eg %) by date within each channel, region, and type
Anyone seen anything like this go by? It is sort of a datacube in perl. Thanks in advance for any ideas.