Intro: Easy Computer Programming
A very EASY and FREE way for ANYONE to write their first computer program in TEN MINUTES.
This instructable is for people that think that programming is some sort of magical thing that you need expensive programs or high tech skills to do. Hopefully this instructable will remove the veil from their eyes to show them that it is easy and accessible to anyone with a computer. If you want to learn more, buy a book. The 'Sam's Teach Yourself ... in 30 days' books are good.
Step 1: Get the Necessary Stuff
we'll be programming in the Perl programming language because it's very easy to use and free. Also, you can easily integrate it with the internet, etc.
So, you'll need a 'Perl Interpreter' to understand the code you type. Get ActivePerl (a Perl interpreter) here:
click download, enter fake name, etc
If using windows download the MSI, if it doesn't work download the AS package instead.
once downloaded, install it (just double click it, then use all the default options in the install).
Step 2: Check to See If You Installed It Correctly
if you're paranoid and want to see if it was installed correctly, go to the DOS prompt and type: perl -v
it should show you all the version information.
to open the DOS prompt either:
A) Find it in the start menu (see image below: "Start", "Programs", "Accessories", "Command Prompt")
B)you can just click "Start" then "Run" and type cmd.exe in the window that appears.
Step 3: Write Your First Program
start up a text editor (like 'notepad.exe' which comes with windows; Do -NOT- use word or wordpad, they add invisible stuff to the text!). You can find notepad in the same part of the start menu as the DOS prompt (see pic in previous step).
I like to use EditPad.exe which I got free from the internet: http://www.editpadpro.com/editpadclassic.html
write your first program:
print "Hello, World!\n";
save it as hello.pl (make sure you save it with .pl as the extension, not hello.pl.txt).
To make sure the '.txt' doesn't get added automatically to your filename, click 'Any file(".")' next to 'Save as type'. (see picture below)
Also, to make it easier to test, save it in the c:\Perl\ directory (or wherever you installed the Perl interpreter, by default it installs in c:\Perl\).
is some crap you have to put at the start of all your programs.
is the symbol for a new line. So when Perl sees this it moves the cursor to the next line (like when you press the return key)
Step 4: Run Your Program
go to the DOS command prompt (or DOS window in windows), go to the Perl interpreter directory, for instance c:\perl\
if you don't know how to change directories in DOS, this is how you would do that: cd c:\perl
then type perl -w hello.pl
(you could also just type hello.pl if you associated .pl files with the Perl interpreter during installation)
you should see Hello World!
yay!!, your program works!! If not, then you messed up/skipped one of the steps above.
Step 5: Write Better Programs!
To write more interesting programs find example code on the internet or buy a book. I've always been pleased with the 'Sams Teach Yourself ... in 21 days" books.
Here are a some good websites to learn more Perl from (found by googling: Perl tutorial)
The "Sam's Teach Yourself ... in 21 days" are excellent books to learn _ANY_ programming language (I've used them for several):
Great Programming Books
I got the cartoon below from: http://www.qwantz.com/peoplearecool.html