I am just guessing, but I figure that there are other things other than 'articles', maybe 'books' or whatever. One thing that might be considered is to take out one of the "levels of indirection" and add a field to the sub-hashes.
my $AoH =
[
{
'type' => 'article',
'SKU' => [ 'CDS00013', ],
'InternalSKU' => '179',
'AvailableItems' => ['100',],
},
{
'type' => 'article',
'SKU' => [ 'CDS00014', ],
'InternalSKU' => '180',
'AvailableItems' => ['102',],
},
{
'type' = 'book',
'SKU' => [ 'CDS00015', ],
'InternalSKU' => '220',
'AvailableItems' => ['103',],
},
];
This can make sorting/searching much easier. An AoH in Perl works pretty much like an array of struct in C. And this can be translated into a DB with minimum fuss. Just an idea to consider. |