in reply to Syntax Error with Embedded Structs
I read this and I thought "Struct? Struct? What the heck is up with Structs in perl?" Then it hit me : you're using Class::Struct. That would be a good lead-in to the question =)
It *seems like* overkill and retrograde non-Perlishness to me (I'll confess to not having any use for the module in question). Were it me, I'd use a home-grown data structure and avoid the problem (basic idea: each day would be an anonymous array of appointments, each of which is itself an anonymous array of start and end times; the whole shebang would be an array of days. Sounds complicated, but I think the syntax for dealing with it is less hairy. Still, you've got something different going on here)
should probably be written$days[$dayCount]->appts[$numAp]
$days[$dayCount]->appts($numAp) = $temp;
Because, near as I can tell from reading the documentation, that there's a function call, not an array index.
Update pfeh ... that won't work either, but for a different reason. I'd go with princepawn's suggestion and push a value onto that array. But the oddness of this all is what makes me long for a good old fashioned AoAoA =) (3d array ...)
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
|
|---|