First steps

learn.perl.org
 

How to get started with your first Perl script

After installing Perl you will want to actually run some Perl code. You need to use a command line (Windows, Mac OSX, Unix/Linux) program to do this.

Check you have Perl installed by typing the command below into your command line program:

perl -v

Now create a 'perl_tests' folder to save your test files into, you will need to be able to find this from the command line.

Open a text editor (Windows, Mac OSX, Unix/Linux) creating a new file with the following content

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

print "hi NAME\n";

Save this file as plain text into your 'perl_tests' folder, name the file 'hello_world.pl'.

Then run the script from the command line by typing:

perl /path/to/perl_tests/hello_world.pl

Open the file again and replace NAME, with your name. Save the file.

Run the script again by typing

perl /path/to/perl_tests/hello_world.pl

Video of the above steps

(Mac version)

Bookmark and Share