Creating the “Hello, world!” Script

It’s some kind of unwritten law that the first program you create in a new language should print out the message Hello, world! I’m not sure who originated the practice, but far be it from me to violate it. If you want to modify the following instructions to make your first Perl script say Hello, sailor! or Hey, bignose! or something else you find equally (or probably more) amusing, go right ahead.

For this demonstration I’m going to assume that you’ll write this script on the Unix server using the pico text editor. (If your Unix server does not have pico available, you will probably need to look into using emacs or vi; see Chapter 1.) If you want to write the script on your local PC or Mac, that’s fine, too; just remember that you’ll have to upload it to the Unix server via FTP (ASCII upload, please) before you can test it.

You start up pico by entering the command pico in the Unix shell (clever, eh?). There are some special features of pico you can turn on with command-line options, and we’ll be using three of them: -d (which makes your keyboard’s Delete key erase the character under your cursor, rather than the character to the cursor’s left), -w (which turns off automatic word wrapping), and -z (which allows you to suspend the pico program by typing Ctrl-Z; more about that later).

Tip

Although I show pico’s command-line options merged together with a single leading hyphen (-dwz), older versions of pico may require you to enter them separately, ...

Get Perl for Web Site Management 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.