Perl Script Characteristics

Perl scripts are just text files, and you can create them using any text editor. All Perl scripts in this chapter follow the UNIX convention of using a first line that begins with '#!', followed by the pathname of the program to use for executing the script. The line I use is as follows:

#! /usr/bin/perl

You'll need to modify the '#!' line if the pathname to Perl is different on your system, such as /usr/local/bin/perl5 or/opt/bin/perl. Otherwise, Perl scripts won't run properly on your system.

I include a space after the '#!' because some systems interpret '#! /' as a 4-byte magic number, ignore the line if the space is missing, and thus treat the script as a shell script.

Under UNIX, a Perl script should be ...

Get MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.