473,246 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 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 3401
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: PHPkemon | last post by:
Hi there, A few weeks ago I made a post and got an answer which seemed very logical. Here's part of the post: PHPkemon wrote: > I think I've figured out how to do the main things like...
2
by: Joe Lui | last post by:
Hello everyone, I am new to PHP and web server in general so please bear with me if it's an obvious mistake. My problem is that parameters entered in URL do not update php variables. I am...
1
by: Robert V | last post by:
Hi all, I could use some help programming on of my Perl script to handle different submit buttons within the same form. Here is what I have so far. A user goes to a Web form and inputs some data...
3
by: Netghost | last post by:
Hey I've had a simple script that disabled my back button of my browser, but i've seem to have lost it. Someone who can give me the code, or where to find it? Same goes for disabling the right...
3
by: xrongor | last post by:
hi. i need a simple, hopefully free html editor that besides the standard features has the following properties: allows frames. and will allow me to create a "directory" based on data...
28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.