Tech Support Guy banner
  • Please post in our Community Feedback thread for help with the new forum software! If you are having trouble logging in, please Contact Us for assistance.
Status
Not open for further replies.
1 - 10 of 10 Posts

·
Registered
Joined
·
77 Posts
Discussion Starter · #1 ·
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.
 

·
Registered
Joined
·
1,964 Posts
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.
 

·
Registered
Joined
·
2,636 Posts
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.
 

·
Registered
Joined
·
72 Posts
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
 
1 - 10 of 10 Posts
Status
Not open for further replies.
Top