eXoR
08-27-2004, 07:50 AM
I've found the following data structure in an example Perl script that handles Facetted Clasification ( http://www.geocities.com/xtopicmaps/FacetedTaxonomy.html#code ):
$ListOfItems = {
'0001' => {name => $naam, category => ['Sport,SeaSport', 'Location,Island,Crete']},
'0002' => {name => 'Hotel Beta', category => ['Sport,SeaSport', 'Location,Mainland,Pilio']},
'0003' => {name => 'Hotel Gamma', category => ['Sport,WinterSport', 'Location,Mainland,Pilio']},
'0004' => {name => 'Hotel Delta', category => ['Sport,WinterSport', 'Sport,SeaSport', 'Location,Mainland,Pilio']},
'0005' => {name => 'Hotel Epsilon', category => ['Sport,WinterSport', 'Location,Mainland,Olympus']},
'0006' => {name => 'Hotel Zeta', category => ['Location,Mainland,Olympus']},
};
After this initial creation and initialization of the data structure, I'm trying to dynamically add elements to it from the contents of a SQL query. This is where I'm having problems though; the script does not the entry that is supposed to be created by following statement:
$ListOfItems{'0007'} = {name => 'Hotel Delta', category => ['Sport,WinterSport', 'Sport,SeaSport', 'Location,Mainland,Pilio']};
Can anyone tell me the correct syntax for adding elements to this data structure and supply me with additional information on what kind of data structure it is? I'm currently thinking its a hash of arrays, is this correct?
Thanks in advance.
$ListOfItems = {
'0001' => {name => $naam, category => ['Sport,SeaSport', 'Location,Island,Crete']},
'0002' => {name => 'Hotel Beta', category => ['Sport,SeaSport', 'Location,Mainland,Pilio']},
'0003' => {name => 'Hotel Gamma', category => ['Sport,WinterSport', 'Location,Mainland,Pilio']},
'0004' => {name => 'Hotel Delta', category => ['Sport,WinterSport', 'Sport,SeaSport', 'Location,Mainland,Pilio']},
'0005' => {name => 'Hotel Epsilon', category => ['Sport,WinterSport', 'Location,Mainland,Olympus']},
'0006' => {name => 'Hotel Zeta', category => ['Location,Mainland,Olympus']},
};
After this initial creation and initialization of the data structure, I'm trying to dynamically add elements to it from the contents of a SQL query. This is where I'm having problems though; the script does not the entry that is supposed to be created by following statement:
$ListOfItems{'0007'} = {name => 'Hotel Delta', category => ['Sport,WinterSport', 'Sport,SeaSport', 'Location,Mainland,Pilio']};
Can anyone tell me the correct syntax for adding elements to this data structure and supply me with additional information on what kind of data structure it is? I'm currently thinking its a hash of arrays, is this correct?
Thanks in advance.