1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Enlighten Me to Perl!

Discussion in 'Software Development' started by Zeragrin, Apr 7, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. Zeragrin

    Zeragrin Thread Starter

    Joined:
    Mar 13, 2004
    Messages:
    77
    Ok, ive heard some about perl, but im thinking the people who were trying to explain it to me, were idiots, cuz im still incredibly confused, if someone could please explain what it is exactly, what enviroments it works best in, and some good books to pick up on it, i would be much abliged.
     
  2. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    Perl is a scripting language that can be used from the command line. Perl is often used with CGI to power the backend of websites.
     
  3. SpeedRacer5

    SpeedRacer5

    Joined:
    Feb 10, 2004
    Messages:
    201
  4. Whiteskin

    Whiteskin

    Joined:
    Nov 15, 2002
    Messages:
    1,964
    Perl is an odd language. Its syntax threw me for a curve. (Though, not as much as i c++... c++ bothers me). Anyhow. For starting a scripting language, you may want to start with python, and then move to perl. python will get you used to programming an interpeted langauage, and then perl will allow you to master that skill.
     
  5. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    If your are used to php/c++ and try perl, you'll probably think it's a little funky. However it's not really that much different structure wise.

    Python is a bit differrent than the rest and seems funky at first, but it really makes sense once you get it.

    I suggest trying both python and perl at the same time.

    Here are examples to show differences between python, perl, c++ and java.

    Code:
    [python]
    
    #!/usr/bin/python
    import sys
    
    if len(sys.argv) == 2 and sys.argv[1] in ["--help"]:
        print "\nYou don't need help."
    
    [perl]
    
    #!/usr/bin/perl
    
    if ($#ARGV eq 0 && $ARGV[0] eq "--help") {
    	print "\nYou don't need help\n";
    }
    
    [c++]
    
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    int main(int argc, char *argv[]) {
        if (argc == 2) {
            string address = argv[1];
            if (address == "--help") {
                cout << endl << "You don't need help." << endl;
            }
        }
    }
    
    [Java]
    
    public class proggy {  
        public static void main(String args[]) {
            if (args.length == 1 && args[0].equals("--help")) {
                System.out.println("\nYou don't need help.");
            }  
        }
    }
    
    As you will see, python looks the most different when compared to the others.

    I've never tried to have a php script grab arguments on the command line like that, so if somebody want's to add that for comparison that would be cool, but I wouldn't usually use php on the command anyway.

    FYI:

    When you run the programs, they will do nothing unless you run it with the argument --help.

    test.pl --help
    test.py --help
    etc.

    Once you get the hang of them all (even regular ol javascript), switching to a new language would be easier.

    Also, on Windows, I would say it's more likely that a person has perl than python.

    The cool thing about perl and python is, you don't have to compile the programs. Plus, similar to java, your perl/python program will work on any system that has the perl/python interpreter installed.

    For webpages etc. , perl suits me fine and never really required me to use python.
     
  6. Trag

    Trag

    Joined:
    Sep 10, 2003
    Messages:
    72
    I have programmed in Perl for a couple of months, and find it an extremely easy to use language (It is also easy to read). My only problem with it is that it is interpreted and not compiled. Perl is mainly used for CGI scripting, but anything can be written in perl (including games, search the web for "Frozen Bubble windows port")provided you don't mind having a command window open at the time (assuming you're running windows). Also, check out URL=www.perlmonks.org]perlmonks[/URL]It's an excellent site, free registration, and you get a chatbox to ask perl questions in.

    Trag
     
  7. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    I love frozen bubble :D
    Got it on my desktop....
     
  8. Whiteskin

    Whiteskin

    Joined:
    Nov 15, 2002
    Messages:
    1,964
  9. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    True and good point.
     
  10. stod73

    stod73

    Joined:
    Aug 13, 2003
    Messages:
    832
  11. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/218107

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice