in reply to best data structure

You may want to look into Tie::IxHash. That module implements Perl hashes that preserve the order in which the hash elements were added. You can use the normal hash functions, such as exists, and you can also use "arrayish" functions, such as Push and Shift.

-- Mike

--
just,my${.02}