Help needed programming a simple script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Proteus

    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,Wh at 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,Wh at is the color of the sun?,
    Points,1,
    Difficulty,1,
    Option,0,red,
    Option,0,yellow ,
    Option,100,blue ,
    Hint,,,
    Feedback,,,
  • Proteus

    #2
    Re: Help needed programming a simple script

    On Thu, 22 Sep 2005 15:20:06 +0300, George Bouras wrote:
    [color=blue]
    > # I hope this is doing what you want...[/color]

    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!

    Comment

    Working...