pwhysall has asked for the wisdom of the Perl Monks concerning the following question:
and so on and so on. What would be a good way of reading this file into a data structure that I can use nicely? I'd thought of setting up a couple of objects; a Section object, which would then contain a number of Item objects. And maybe an overall object to hold all the Section objects. But I'm stalling at the file parsing stage. I don't seem to be able to do this kind of thing:begin_section name=section_name type=section_type begin_item name=item_name desc=item_description link=item_link end_item begin_item . . . end_item end_section begin_section . . . end_section
Am I approaching this problem the wrong way? Many thanks in advance for any advice you may have.if(/begin_item/) { while (!/end_item/) { ...deal with data members here... } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Turning a datafile into a data structure
by davorg (Chancellor) on Jun 30, 2000 at 12:50 UTC | |
|
Re: Turning a datafile into a data structure
by ase (Monk) on Jun 30, 2000 at 15:13 UTC | |
|
RE: Turning a datafile into a data structure
by JanneVee (Friar) on Jun 30, 2000 at 15:11 UTC | |
|
Re: Turning a datafile into a data structure
by takshaka (Friar) on Jun 30, 2000 at 21:59 UTC | |
|
Re: Turning a datafile into a data structure
by btrott (Parson) on Jun 30, 2000 at 20:29 UTC | |
|
Many, many thanks
by pwhysall (Acolyte) on Jun 30, 2000 at 18:21 UTC |