in reply to Graph File Parsing
I might have messed up the indentation, as to how it builds the hashes, but I think the point is clear. Also if you do something like x = 10 20 30 40, when you reference conf->{x} it will return an array ref, the contents of which is 10, 20, 30, 40.. you can alter the delimiter, which is whitespace by default to something else, so on and so forth with all the perl yummy goodness.# File blah.conf <graph> <node> title = node1 <loc> x = 10 y = 20 </loc> </node> <node> title = node2 <loc> x = 10 y - 29 </loc> </node> <edge> sourcename = node1 targetname = node2 </edge> </graph> # After parsing file and placing into %conf you will have %conf = ( node = { title = { node1 = { loc = { x => 10, y => 20, }, }, node2 = { loc = { x => 10, y => 20, }, }, }, }, edge = { sourcename => node1, targetname => node2, }, ) # You can then reference pieces thereof via $conf->{node}->{title}->{node1}->{loc}->{x};
|
|---|