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

 About This Book

 Perl on Linux Systems

 ActivePerl on Windows Systems

 Data Types: Values and Variables

 Expressions, Operations and Simple Statements

 User Defined Subroutines

 Perl Built-in Debugger

 Name Spaces and Perl Module Files

 Symbolic (or Soft) References

 Hard References - Addresses of Memory Objects

 Objects (or References) and Classes (or Packages)

 Typeglob and Importing Identifiers from Other Packages

 String Built-in Functions and Performance

 File Handles and Data Input/Output

 Open Files in Binary Mode

 Open Directories and Read File Names

 File System Functions and Operations

 Image and Picture Processing

 Using DBM Database Files

 Using MySQL Database Server

 Socket Communication Over the Internet

 XML::Simple Module - XML Parser and Generator

 XML Communication Model

 SOAP::Lite - SOAP Server-Client Communication Module

 Perl Programs as IIS Server CGI Scripts

 CGI (Common Gateway Interface)

 XML-RPC - Remote Procedure Call with XML and HTTP

 RPC::XML - Perl Implementation of XML-RPC

 Integrating Perl with Apache Web Server

 CGI.pm Module for Building Web Pages

 LWP::UserAgent and Web Site Testing

 Converting Perl Script to Executable Binary

Managing Perl Engine and Modules on macOS

Perl Version Pre-Installed on macOS

 Install Xcode Command Line Tools

 Configure CPAN Shell

 Install Perl Module from CPAN

 Install Perl Module from Source Code

 References

 Full Version in PDF/EPUB