Networking Made Easy

Before we get into details, let's look at two simple programs.

The lgetl.pl script (for "line get local," Figure 1.1) reads the first line of a local file. Call it with the path to the file you want to read, and it will print out the top line. For example, here's what I see when I run the script on a file that contains a quote from James Hogan's "Giants Star":

Figure 1.1. lgetl.pl—Read the first line of a local file

% lgetl.pl giants_star.txt
"Reintegration complete," ZORAC advised. "We're back in the universe."

This snippet illustrates the typographic conventions this book uses for terminal (command-line interpreter) ...

Get Network Programming with Perl 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.