Think about Loose Coupling | |
PerlMonks |
Parsing chapter id'sby tune (Curate) |
on May 05, 2001 at 08:50 UTC ( [id://78195]=perlquestion: print w/replies, xml ) | Need Help?? |
tune has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I have a great challenge for you to show your regexp and/or other perl skills. I am working on a text file parser, which is importing records into a database. Each row is a document which have a chapter list identifier, like 1.1. or 2.4.5.6 When i am reading a row, i want to know the prior chapter to the current one. For example 1.1.'s prior is 1., 2.4.5.6's is 2.4.5. So the question is if how you dig it out from the identifier. I have a solution, (so it is not a homework that i want to be solved by others), but I would like to see your faster, more clever, and more obfuscated solutions! So chapter up! My solution: As you see it is not sure if the point is presented at the end of the chapter identifier or not ( \.? ) --
Back to
Seekers of Perl Wisdom
|
|