Just another Perl shrine | |
PerlMonks |
Two files from one.by ellem (Hermit) |
on May 22, 2002 at 14:37 UTC ( [id://168439]=perlquestion: print w/replies, xml ) | Need Help?? |
ellem has asked for the wisdom of the Perl Monks concerning the following question:
I have a .txt document with the following format:
15. What is the average airspeed velocity of a sparrow? a. 1,000,000 b. African or European c. With or without a coconut d. Your Mother smells of elderberries Answer: d What I'd like to do is make two separate files: One like this: 15. What is the average airspeed velocity of a sparrow? a. 1,000,000 b. African or European c. With or without a coconut d. Your Mother smells of elderberries One like this: 15. Answer: d The idea being that I want to separate the Answers and the Questions. I can't seem to get started properly. I understand I need to match certain words and that I need to hold the Question number in a variable for a moment while I get the answer so I can put them together but I am getting confused on the process. Not so much on the code. How would you do this? (Psuedo code welcomed) -- ellem@optonline.net There's more than one way to do it, but only some of them actually work.
Back to
Seekers of Perl Wisdom
|
|