2. Basic Output (The "Hello World" program)
In Perl we use the print command to echo strings and expressions to the screen.
The neophyte "Hello World!" program can be written in perl as follows:
print "Hello, World!\n";
Now here's some explanation (in case you need any):
- The string is enclosed in double-quotes(" ... ") because that's how string constants are represented in perl.
- \n is a special character that is called "newline". When you print a newline you will see that your output started on a new line.
- 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.