|Problems? Is your data what you think it is?|
Printing a hash in a specific order?by Limbic~Region (Chancellor)
|on Mar 15, 2003 at 14:04 UTC||Need Help??|
Limbic~Region has asked for the
wisdom of the Perl Monks concerning the following question:
I am currently working on my first OO project and would like to be able to do something like $record->Print; and have it correctly output the record in the proper format. Unfortunately, the object is stored in a hash - and we know that the hash typically comes out differently than the order it went in.
For complete details on the OO project, you can take a look at this link or you can just readmore for the output format I am looking for:
What I have currently looks something like this:
My question - is there a better/smarter way to do this? I guess what I am asking is there a generic way to template hash output that I am unaware of? Since this is my first OO project, I really didn't know what I was getting into. I think if I were to start over, I would make my object a complex array instead of hash. Is that also the wrong approach?
Thanks in advance - L~R