Enlighten Me to Perl!

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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.
 
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.
 
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.
 
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.
 
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
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Members online

Top