Hello World in Perl
The Script
Always best to dive in with an example, I think! So, here's the bog-standard HelloWorld program in Perl:
# This program print Hello World! print 'Hello World!';
Exciting, huh? Now, if you save this as HelloWorld.pl, then you can type
perl -w HelloWorld.pl
to compile and execute it (for Active Perl anyway).
Analysis
There are only really 3 points to make about this script:
-
Comments start with a #, and take the rest of the line
-
print outputs to the STDOUT stream (your DOS window, probably), and there's no CR/LF appended to the end.
-
Lines that aren't comments end with a ";"
So, with that over and done with, we can get on with learning Perl..
.