471,310 Members | 1,057 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Help needed programming a simple script

Any help appreciated on a small perl project I need to write for
educator/teaching purposes. I have not programmed perl for some time, need
to get up to speed, maybe some kind souls hrere will help me on
this project? It looks to be a simple project, and I will start relearning
pearl, but any help appreciated!

I need to read and parse a simple text file (INPUT) containing multiple
choice quiz questions (with titles) and answers, and convert to a special
comma separated value (csv) format (for importing into a special
application). Here is a sample of a couple of questions from the input
file, and how it needs to be written to the output (csv) text file:

//INPUT plain vanilla text file of questions. Each question has a
//Title, a number for the question followed by a space, an optional
//img tag as seen below to specify an images for a question, and
//possible multiple choice answers, correct answer maked with *
//Might be a..b, a..c, a..d, or a..e possible number of choices.

Title:fibula bone
1. What bone is seen here?
[img:"/images/fibulahead.gif"]
*a. head of fibula,
b. tibia diaphysis,
c. sacrum bone,
d. hip bone,

Title:Sun color
2. What is the color of the sun?
a. red
*b. yellow
c. blue
//OUTPUT file needed after conversion program is written.
//Points and Difficulty always will be '1'. Hint and Feedback
//lines always will be blank as seen below. Correct answer for
//a question has Option,100 associated with it as seen here.

NewQuestion,MC,
Title,fibula bone,
QuestionText,What bone is seen here?,
Points,1,
Difficulty,1,
Image,/images/fibulahead.gif,
Option,100,head of fibula,
Option,0,tibia diaphysis,
Option,0,sacrum bone,
Option,0,hip bone,
Hint,,,
Feedback,,,

NewQuestion,MC,
Title,Sun color,
QuestionText,What is the color of the sun?,
Points,1,
Difficulty,1,
Option,0,red,
Option,0,yellow,
Option,100,blue,
Hint,,,
Feedback,,,
Sep 21 '05 #1
1 3282
On Thu, 22 Sep 2005 15:20:06 +0300, George Bouras wrote:
# I hope this is doing what you want...


Thank you George, and Paul. I will study and try out your code. I started
releaning perl yesterday, printed out an online manual of perl, started
writing some code. But I am sure you guys know light years more than me
and I will tinker with your code to hopefully get a workable utility
program!

Sep 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by PHPkemon | last post: by
1 post views Thread by Robert V | last post: by
3 posts views Thread by Netghost | last post: by
3 posts views Thread by xrongor | last post: by
28 posts views Thread by stu_gots | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.