Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

RE: Turning a datafile into a data structure

by JanneVee (Friar)
on Jun 30, 2000 at 15:11 UTC ( [id://20578]=note: print w/replies, xml ) Need Help??


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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://20578]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found