4.3. Environment

On the command line one can type:

perl -e "print 42"

perl -v

perl -V

Example 4-1. examples/intro/hello_world.pl

#!/usr/bin/perl
use strict;
use warnings;

print "Hello world\n";
print 42, "\n";
run it by typing perl hello_world.pl

On unix you can also make it executable: chmod u+x hello_world.pl and then run like: ./hello_world.pl

A couple of notes

  • Strings and numbers

  • Strings must be quoted, you can use special characters such as "\n"

  • The print statement (Output) - gets comma delimitered list of things

  • ; after every statement


If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed