in reply to Turning a datafile into a data structure

Basicly the advice about RecDescent module is the best. You aren't exactly approaching it in the wrong way.

Important things to remember are things like error_handling. i.e. in your example

if (!/end_item/) { if(/begin_item/) { while (!/end_item/) { ...deal with data members here... } } } else { ... print or die an error message here about an end_item without b +egin ... }
or if you have items in items. then you must handle which end belongs to which begin!

Some of these things that one must think of you get for "free" using the module that davorg suggested...