Perl Tutorial

Discussion in 'Web Design & Coding' started by undeadpenguin, Oct 20, 2003.

  1. undeadpenguin

    undeadpenguin Bang. VIP Member

    Joined:
    Sep 1, 2003
    Messages:
    925
    Likes Received:
    4
    Location:
    US, CT
    Does anyone know of a good free Perl tutorial on the web? I just want basic stuff:
    -Basic input/output
    -Declare variables
    -Loops
    etc.
    Then a more advanced tutorial (I'll probably pick up a book from my library).
     
    undeadpenguin, Oct 20, 2003
    #1
    1. Advertisements

  2. undeadpenguin

    undeadpenguin Bang. VIP Member

    Joined:
    Sep 1, 2003
    Messages:
    925
    Likes Received:
    4
    Location:
    US, CT
    I found a nice little tutorial (well actually a website, learn.perl.org), and studied the stuff for a few days (it's pretty similar to C++ so I understand it well, I think). I decided to make a calculator program to try out my new Perl skills. Only problem is that everytime I run it, I get this error:
    syntax error at /home/kyle/calculator line 10, near ")
    {"
    syntax error at /home/kyle/calculator line 20, near "}"
    Execution of /home/kyle/calculator aborted due to compilation errors.

    Here's the code:
    print "Please enter a command: ";
    my $command;
    $command = <STDIN>
    if( $command = "h" )
    {
    print "Kalculator Version 1.0.01 \n";
    print "Enter a command at the prompt \n";
    print "Commands: \n";
    print "* - Multiplication \n";
    print "a - Addition \n";
    print "d - Division \n";
    print "e - Exponentition \n";
    print "m - Find a modulous \n";
    print "s - Subtraction \n";
    }
    Anyone see what's wrong with it?
     
    undeadpenguin, Oct 22, 2003
    #2
    1. Advertisements

  3. undeadpenguin

    undeadpenguin Bang. VIP Member

    Joined:
    Sep 1, 2003
    Messages:
    925
    Likes Received:
    4
    Location:
    US, CT
    Figured it out. I was missing a semi-colon after "<STDIN>" :)doh ). The other problem was I should have had == instead of = in the if statement.
     
    undeadpenguin, Oct 23, 2003
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.