Perl scripting 101: Chapter 1: Introduction





Perl, the much despised, and loved glue language.

I started learning perl cause I wanted something slightly faster and more powerful than bash, i still USE bash in fact i use bash and perl, but it always happens that mid script i'll find a stumbling block

in a perl script i'll go.."durn this would have been easy in bash", in a bash script i'll go, "durn this would have been easy in perl". the way to know if you chose the language for the job is, are you running into a majority of 'this would be easier in X', if you are, you probably chose poorly.

if you read my bash 101 series, you'll know i don't teach the way anyone else does. i'll try to keep that up, i'll try to keep the same 'order of introduction' as well

Like the bash 101 series i do assume at least a working knowledge of your shell/commandline, be it bash, cmd, 4nt, tcsh, korn, powershell, zhell (amigaos) or what ever. I also assume a working knowledge of some text-editor on your platform (notepad, editplus, nedit, vi/vim/elvis, emacs, ultraedit, cygnusED)

Also, just like the bash 101, this isn't so much written for others as it is an exercise for me in clearly and concisely explain what i've learned, ie, learn by teaching, gain understanding by forcing oneself to examine what one knows.

Now as in the bash 101, this first chapter may just be a 'pain'

so let's get started, in general i hate hello world programs but hey it's traditional.

let's find out IF you have perl and what version it is

whereis perl #unix systems only perl -V # gives perl version

windows users, you probably won't have perl unless you installed it yourself, activestate perl is pretty good and easy to install

We'll stick to the commandline to start with, perl can be invoked
semi-interactive = perl -d -e 42
#ok so the above one actually uses perl debugger
commandline = perl -e "program_snippet_here"

perl -e "print(\"Hello World\n\");"

The above is probably the neatest hello world

I'm not really going to go into it more for the commandline, there are multiple good 'one liner' books out there

so go forth in peace and find a texteditor you like (and no, word is NOT a text editor!)




Perl scripting 101: Main page Perl scripting 101: Chapter 2



w0nderer