"Perl for Perl Newbies" - Part 1Basic Output (The "Hello World" program)

2. Basic Output (The "Hello World" program)

In Perl we use the printcommand to echo strings and expressions to the screen.

The neophyte "Hello World!" program can be written in perl as follows:

"Hello, World!

Now here's some explanation (in case you need any):

  1. The string is enclosed in double-quotes( " ... ") because that's how string constants are represented in perl.
  2. \nis a special character that is called "newline". When you print a newline you will see that your output started on a new line.
  3. The semi-colon ( ;) at the end indicates that this is the end of a perl command. Every perl command should be terminated with a semicolon.

Written by Shlomi Fish