Perl Tutorials - Herong's Tutorial Examples - 6.00, by Dr. Herong Yang
Perl Version Pre-Installed on macOS
This section provides notes to verify Perl version supported on macOS and run a simple Perl script.
macOS comes with Perl pre-installed. Here is what I did to verify the Perl version and program file location:
1. Start a Terminal and run "perl -v" to see the Perl version number:
herong$ perl -v This is perl 5, version 18, subversion 2 (v5.18.2) built for ... (with 2 registered patches, see perl -V for more detail) Copyright 1987-2013, Larry Wall ...
2. Create a simple Perl script and run it:
herong$ cat > hello.pl print "Hello world!\n"; Ctrl-d herong$ perl hello.pl Hello world!
Note that you need to press "Ctrl" and "d" together to end the input for the "cat" command.
3. Verify Perl program file locations:
herong$ which perl /usr/bin/perl herong$ ls -l /Library/Perl/ total 0 drwxr-xr-x 3 root wheel 102 Mar 23 2017 5.16 drwxr-xr-x 10 root wheel 340 Sep 27 17:08 5.18 drwxr-xr-x 3 root wheel 102 Sep 27 20:21 Updates
Table of Contents