Announcement

Collapse
No announcement yet.

My first perl script! And, it' not, um, working.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • My first perl script! And, it' not, um, working.

    My God in heaven! Just one little character off and the whole Goddamn script is screwed. I have checked over it a thousand times, and it will not run properly. I don't know what it is, I tried looking for the small errors (being as those are usually the ones that catch you in the ass!) and I still can't seem to find it. Here's the script, for anyone that can read and understand perl. Maybe you could help me find out what it is that's wrong with it:

    #!/usr/bin/perl

    require "formprocessor.cgi";

    &ReadParse(*input);

    $name= $input{'name'};
    $hate= $input{'hate'};
    $form= $input{'form'};
    $color= $input{'color'};
    $election= $input{'election'};
    $admire= $input{'admire'};
    $death= $input{'death'};
    $posession= $input{'posession'};

    if ($form="plural")
    {
    pack of rabbid
    }

    if ($election="kerry")
    {
    Bush has won the election, and is now dominating the entire world.
    }

    if ($election="bush")
    {
    Kerry has won the election, and is now dominating the entire world. Even so, he still pulled the troops out of Iraq. Go figure.
    }

    print "Content-type: text/html\n\n";
    print "<HTML><BODY>";

    print "Here is your horoscope! Enjoy!";
    print "Well first of all, $name, it seems as if my crystal ball is telling me that you will be consumed by a $color $hate.";

    print "$election";
    print "$admire has been kidnapped by aliens.";
    print "You will meet your end very soon by $death";
    print "Your $posession is now in a pawn shop in Florida. If you it is next to you, the moment you leave it, it will disappear.";

    print "</BODY></HTML>";

    --------------------------------------------------------
    And here's the form that the above script processes:

    <html>
    <body>
    <form method="post" action="http://rain.prohosting.com/jaredmg/horoscope.cgi">
    <br>
    <br>
    <br>
    <hr>
    <pre>
    What is your name? (First and Last) <input type="text" name="name">
    </pre>
    <br>
    If there is one thing that you hate on this planet the most, what is it?<input type="text" name="hate">
    <br>
    Is that object that you mentioned in plural form or singular?
    <br>
    Singular<input type="radio" name="form" value="singular">
    Plural<input type="radio" name="form" value="plural">
    <br>
    <hr>
    <br>
    <pre>
    What is your favorite color? <select name="color">
    <option value="red">red
    <option value="orange">orange
    <option value="yellow">yellow
    <option value="green">green
    <option value="blue">blue
    <option value="purple">purple
    <option value="brown">brown
    <option value="black">black
    <option value="pink">pink
    </select>
    </pre>
    <br>
    <hr>
    <br>
    Who do you want to win the election?
    <br>
    Bush<input type="radio" name="election" value="bush">
    Kerry<input type="radio" name="election" value="kerry">
    <br>
    <hr>
    <br>
    Who in this world do you absolutely admire?<input type="text" name="admire">
    <br>
    <hr>
    <br>
    Describe in detail what kind of death you would hate the most, in this particulare format:
    <br>
    <u>Death by-(whatever it is)</u>
    <br>
    You don't need the parantheses are the hyphen, just simply type it in according to the previous fassion. Doing otherwise will screw up the next part.
    <br>
    <textarea name="death" wrap="virtual" rows="3" col="60">
    </textarea>
    <br>
    <hr>
    <br>
    What is your most prized posession? <input type="text" name="posession">
    <br>
    <hr>
    <center><input type="submit"></center>
    <center><input type="reset"></center>
    <hr>
    </form>
    </body>
    </html>


    Thanks to anybody that can help me out! [img]/images/graemlins/notworthy.gif[/img]

  • #2
    Re: My first perl script! And, it\' not, um, working.

    Okay, I found one of the bugs! Sorry it's so long, I tried to edit it, but the time had expired. So far, I've gotten part of it to work, but I need more time spent on the "if" statements. It's almost working. The browser will at least digest it, which is a good sign, and now I can see what the other problems are.

    Yes, I realize it's a cheesy little program, but sometimes you just gotta test what you can do. It's late, and I've only had a few minutes to come up with an idea. Now if I could just learn a couple formatting techniques in perl...

    Comment


    • #3
      Re: My first perl script! And, it\' not, um, work

      Did you ever get this to work? I know a little about Perl... Let me know where you are at and I will see if I can help.

      It looks like in the if statements you should do something like:
      $result = "Bush has won the election, and is now dominating the entire world.";

      and later
      print "$result <br>\n";

      Comment


      • #4
        Re: My first perl script! And, it\' not, um, work

        Perl for Dummies is a great book.
        Occupy JCF

        Comment

        Working...
        X