In school, I'm studying Perl programming, so I thought I'd share my knowledge with you. I hope you enjoy, and if you have any questions, please don't hesitate to ask.
----------------------------------------------------------------------------------------------------------------------------------------------
Requirements:
You will require a FREEWARE program called "ActivePerl" to run Perl scripts on your home computer. This program can be grabbed from: http://www.activestate.com/activeperl/
You will also need a text editing program - Notepad is fine.
What is Perl?
Perl is an interpreted programming language mostly used for web applications. While Perl can be used for desktop applications, it's recommended that you learn a different programming language if you do want to create desktop applications. Perl is well known for it's strong and file manipulation. Best of all, it's easy to learn!
Your first program - Hello World.
Open up Notepad, or another similar text editing program, and enter the following code:
#!(YOUR PATH TO PERL.EXE HERE SUCH AS C:/PERL/BIN/PERL.EXE) print 'Hello World';
Save the program as hello.pl.
Open up your command prompt, and go to the directory where you have saved hello.pl. Say for example, it was saved in "my documents", the command you would type in is:
CD my documents
Now, type in the following into the command prompt:
perl hello.pl
The program should say "Hello World" to you. Congratulations, you have just written your first PERL application!
Analysis
So you're probably wondering what all the code did?
The first line gives the directory of Perl. The # symbolises that the line is a comment and should be ignored by the interpreter (Perl).
The second line 'prints' / outputs text to the screen. The " ' " are extremely important, otherwise Perl will treat Hello World as a command rather than text to be outputted.
Also, note the " ; ", this should end most of the lines of code you write in Perl.
----------------------------------------------------------------------------------------------------------------------------------------------
I hope this has helped,
Thanks!
Edited by sharkbate24, 11 June 2009 - 09:34 AM.