Perl: Hello World!

Here you are the code of our very first script we made in lesson1:

#!/usr/bin/perl
 
$yourname = 'George';
print "Hello world!\n";
print "and hello $yourname too!\n";

Remember that if you want to add comments they should be preceded by the # character. The very first line is an instruction for the shell rather than for Perl, but at the moment just remember to add it.

Each instruction has to end with a “;”.

\n is the special way to add a new-line.

Do you remember the difference between double quotes and single quotes?

 

Tagged ,

Leave a Reply

Your email address will not be published. Required fields are marked *