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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.