Think about Loose Coupling | |
PerlMonks |
RegEx Riddleby ferddle (Initiate) |
on May 28, 2008 at 05:39 UTC ( [id://688802]=perlquestion: print w/replies, xml ) | Need Help?? |
ferddle has asked for the wisdom of the Perl Monks concerning the following question: Monks, I have a KML file that I need to parse. I would like to do this without the help of a module. Here is an example:I would like to create hashes from all occurrences of <name> and its corresponding <coordinates>. Great, all I need is a way to find any <coordinates> tags that occur on lines after <name>, so that each coordinate is stored in a hash with its corresponding name. One of the problems with this is that there are some <name> tags that exist without <coordinates> (center three lines in the example above). In other words, the code need only extract the next <coordinates> that occur after a <name> -- these coordinates would only be associated with the <name> that preceeds it, all other <coordinates> would be ignored until found again after the next <name>. These occurrences are not necessarily on consecutive lines From the above, I would need:
If a mod is the only option, please let me know... Thanks for any help,-Newbs
Back to
Seekers of Perl Wisdom
|
|