Ing. Branislav Gerzo wrote:
Hi!

I am thinking about best hash structure, I want save all datas from
hash to database. Example:




Explanation: elements in 'ra' are always 1 times in hash, elements in 'ro' should be zero or more times. Do you think this is good way how to declare hash ?

It depends a lot on how you are using it, but...

In 'ro', is there a particular reason your using numbers 1, 2, ... as keys? If there is not, I'd use an array. Something like:


'name' => { 'ra' => { 'do' => undef, 'od' => '1996-01-07', 'name' => 'brano' }, 'ro' => [ # an array of hashes { # this was {name}{ro}{1}, now it's {name}{ro}[0] 'do' => undef, 'od' => '1998-01-01', 'name' => 'john' }, { 'do' => '1991-05-15', 'od' => '1992-11-01', 'name' => 'michael' } ] }

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to