Introduction: Easy Computer Programming

A very EASY and FREE way for ANYONE to write their first computer program in TEN MINUTES.

Note:
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:

http://www.activestate.com/Products/ActivePerl/

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")

OR

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:

#!/usr/bin/env perl
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\).


#!/usr/bin/env perl
is some crap you have to put at the start of all your programs.

\n
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)
http://www.pageresource.com/cgirec/index2.htm
http://www.sthomas.net/oldpages/roberts-perl-tutorial.htm
http://www.ebb.org/PickingUpPerl/

=============================================================
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

Comments

author
philips05 (author)2016-05-20

This is good website which describes the <a href="http://www.zeepedia.com/answers/question-category/programming/">programming</a> in comprehensive way. This is best for beginners but I think complex coding should also be provided.

author
paulsemon (author)2015-02-26

author
trollolo (author)2012-09-20

trollolololololololololololololololololololo

author
White_Wolf (author)2010-11-26

I love perl.. I used to write many perl scripts for interfacing a GPS with google maps and MirC.
I use a program called OptiPerl.
Almost a WYSIWYG
:0)

author
shoyru_master_11 (author)2010-04-01

RJL makes trojans in Delphi and MS C++ sometimes C# studio and even Visual studio

author
radiorental (author)2006-06-08

the green dino's leg in the last frame is dislocated. I recommend getting him medical attention immediately.

author
radiorental (author)radiorental2006-06-08

or he needs to wee really badly

author
bowmaster (author)radiorental2010-01-11

He needs to wee so badly he dislocated his leg.

author
bmlbytes (author)radiorental2006-11-05

HA!

author
Golem (author)2006-12-17

A few years ago, I learned Perl while developing an application in it to conduct and analyze an on-line survey for my graduate degree. It was very intense, and took a lot of debugging especially due to Perl's non object-orientation. Consequently, I haven't used Perl since then. If I were to learn to use another "web-oriented" programming language, it definitely wouldn't be Perl. Use a programming language which was developed as an object-oriented language from the start and it should have excellent debugging tools too.

author
bowmaster (author)Golem2010-01-11

Object-orientation was introduced on version 5.6, 5.10 is the newest version.

author
saleh5139 (author)2009-08-17

hey does active perl work with vista

author
andrew101 (author)2007-08-28

this is good but you should add how to write more complex programs

author
BLIzKrIEg (author)andrew1012007-08-31

his idea of a complex program is probably... bye world

author
leevonk (author)BLIzKrIEg2007-09-01

not quite,.. but close,.. I write programs that interface animal brains with robotic actuators and sensors

author
dowd95 (author)leevonk2009-07-23

oh blizkrieg....i think he just destroyed u 100 times over

author
cris1133 (author)andrew1012008-01-12

i have a tut on how to do this "a better tut on how to script in perl"

author
bengerszewski (author)cris11332008-07-07

i'll check that out! this one didn't work for me... i'm using 5.10 something or other, and dos doesn't recognize the command to run the script... damn

author
righthandofthedevil (author)2008-04-12

this looks cool but i have a mac. do u know how to do this type of thing on a mac?

author

iMacs have integrated Linux capabilities search for Terminal.app I don't know about Perl, but I know for sure you can do Python

author
tinkerC (author)The_Vinninator2009-07-12

Perl is also part of the package of Mac OS X

author

Search around, there are many free alternative programs for many coding languages out there for the mac, do a google search.

author
tinkerC (author)2009-07-12

I like the Sam's Teach Yourself C in 21 Days. Unfortunately, that and its sequel are no longer published.

author
WarPig137 (author)2009-05-14

Thanks! Awesome Instructable. I always wanted to program, but I'm lazy. This helped... It could walk a blindman with no hands through a "Hello, World!".

author
Barrettkg (author)2009-02-24

TextPad works good for Java (C+) You can run, compile, and it's FREE You download it through SunJava

author
The_Vinninator (author)2009-02-22

you're totally right, Sam's is a great series I also like For Dummies, but they're a little expensive LIBRARY!

author
TJ 47065 (author)2008-05-13

Hi, great instructable i think its good that you showed us how to do this, even if there is a better way(who cares). But i dont see why people are being evil about your instructable.

author
smidge147 (author)2008-05-12

I have the sams teach your self book and it sucks and explains bugger all.

author
naikrovek (author)2006-06-07

If you install ActivePerl correctly (add perl.exe to the system path), you do not need to run your programs from C:\perl. I would *definitely* create a directory to test in rather than putting my Perl programs in c:\perl, where ActiveState installs perl.

author
leevonk (author)naikrovek2006-06-07

how does one "add perl.exe to the system path". And subsequently how does that allow one to put programs in other directories (I never bothered in the past so I don't know how)

author
cris1133 (author)leevonk2008-01-14

for god sakes! go to dos prompt and type setpath

author
radiorental (author)leevonk2006-06-08

on older system one added it to the autoexec.bat but one is not sure how it is done these days with cmd.com

author
BruceR (author)radiorental2006-06-09

On Windows 2000 or XP you do the following. right click on "My Computer" click on Properties click on the Advanced tab click on Environment Variables select Path from the bottom frame and click on Edit Add the path to the folder where perl.exe is (eg. c:\perl) to the end of the variable name seperated by a ; (semi colon) from the previous entries.

author
cris1133 (author)2008-01-03

you an learn how to mnake more advanced scripts in my tut "a better tut on how to script in perl"

author
cris1133 (author)2008-01-03

the \n makes the next line that you print print out on another line and #!\user\bin\perl allows your perl interpeter to go in to interactive mode the same,reason that you need >>> in python

author
TSBob (author)2006-10-11

You should think about finding a professional to do the work for you ;)

author
leevonk (author)TSBob2006-12-06

programming is tedious, but easy. I've written a lot more than hello world programs and in more languages than most professionals have used.

author
BLIzKrIEg (author)leevonk2007-08-31

lol.. go apply for a job at microsoft.... tell them... THE BEST PART ABOUT HIRING ME IS.... I CAN MAKE HELLO WORLD PROGRAMS in C#, visual basic, C++, C, JAVA.

author
munchman (author)BLIzKrIEg2007-12-19

For goodness sakes! Just because this guy posts an Instructable about making a hello world program you think that that is the extent of his programming knowledge?

author
Astrolmonkey (author)2007-01-02

Well, I've been programming since 7th grade, making that 4 1/2 years (61/2 if you can count a graphing calculator in 5th grade!:), and have learned BASIC, c++, java, ADA, and some assembler, and now can add perl to my list after picking it up after reading your instructable. Thank you.

author
munchman (author)Astrolmonkey2007-12-19

WOW! Nice job.

author
g_c_c (author)2006-06-15

Sorry about that, hit the post comment before I was done typing. Long story short, why perl over python or VBScript? Perl is probably the hardest to read and definately has the weakest set of system tools of the three. Obviously I am partial to Python myself, but again- why not VBScript? This tutorial seems geared towards the Windows programmer and VBScript is both easy to use and comes built in to windows. seems an odd choice.

author
BlessedWrath (author)g_c_c2007-11-27

You say VBScript comes with Windows? How should I access this? Are there any tutorials for using it?

author
stasterisk (author)2007-09-03

My favorite perl reference: http://www.steve.gb.com/perl/index.html

author
BLIzKrIEg (author)2007-08-31

before i am temped to post more comments pointing out your idiocy..... a lot of people are pointing it out also.. except for the people that dont know the fact that making something say helloworld is easier that you make it..... so since so many have pointed it out... go think about your instructable for a moment... why is it helpful?? nothing about HOW and WHYS of it.. just type this in.. you just have to have it.. thats not very clear... so you should just edit it instead of replying to every negative comment with a insult.. eh? how bout that for thought?

author
leevonk (author)BLIzKrIEg2007-09-01

I think you need to have sex

author
BLIzKrIEg (author)2007-08-27

why would you want hello world to show up in your cmd? ...... and you should just go and get net beans or visual studio .. instead of using things like perl

author
leevonk (author)BLIzKrIEg2007-08-27

thanks retard, try reading the 'note' right above.

author
BLIzKrIEg (author)leevonk2007-08-31

why.. your welcome.. no no you shouldnt thank me.. i must thank you for telling me how to make something that says.. hello world??!!! and why even use perl? if you want it that simple you can just make one using windows notepad that only requires about 1 min.. installing crappy out of date software.. no? am i wrong? "#!/usr/bin/env perl is some crap you have to put at the start of all your programs." that isnt some crap you have to put at the start of all your programs.. .what if your programming with different software? nothing as S#*%y as perl.. eh? and what is your next instructable going be about??? how to make cmd say bye bye world?

author
leevonk (author)BLIzKrIEg2007-09-01

uhm, doosh, ... I did use notepad

About This Instructable

64,350views

55favorites

License:

Bio: www.leevonk.com
More by leevonk:WolfPack: Large-Dog CarrierVortex-Drive Micro ROV (ROVVor)Squintasaurus: cybernetic dynamically adjustable vision enhancement system
Add instructable to: