On 8 Jun 2000, Stephen Zander wrote:
> >>>>> "Drew" == Drew Taylor <[EMAIL PROTECTED]> writes:
> Drew> I would like to return a single data structure, but order IS
> Drew> important (hence the current setup). I was thinking of using
> Drew> an array, where each element is a hash reference. So I would
> Drew> return something like this:
>
> In this case pseudohashes are absolutely what you're looking for.
> They'll also have the smallest impact on your code as you can walk
> @{$ref}[1..foo] when you need the items in order and grab $ref->{key}
> when you need a particular value. Just remember that $ref->[0] is
> special.
Ugh. Psuedo hash references are badly broken even in 5.6. Anyone who's
done extensive work with them (or tried to) can tell you that.
Instead, write a class for your objects, and use arrays internally. Define
constants for the indexes of the arrays.
--
<Matt/>
Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org