An Example: The Ubiquitous Hello World

A long-standing tradition in the programming world is the Hello World program. When a programmer encounters a new language or a new system, the first program they are supposed to write simply prints “Hello, World!” to the screen. Far be it for me to go against tradition, so the first Perl script we'll examine in this book will do just that. In this section, you'll run a version of Hello World as a one-liner, and then in the next section you'll run Hello World as a standalone script.

Creating the One-Liner

Hello World as a one-liner is about the simplest Perl script you can do, and it's a quick way to find out if you've got Perl installed correctly on your system.

On Unix, from a command prompt, type the ...

Get Sams Teach Yourself Perl in 21 Days, Second Edition 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.