By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,668 Members | 1,503 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,668 IT Pros & Developers. It's quick & easy.

Help needed programming a simple script

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.