File input/output

Filehandling

Definition

A perl program can get input from, and send its output to different places, such as files, devices, and processes.

The connection between the perl program and each such place is given a name, called a filehandle.

Syntax

Unlike variable names, filehandle names do not have any special prefix character.

It is recommended to write them in capital letters, e.g. SOURCE_FILE, IN, OUTPUT etc.

STDIN, STDOUT, STDERR

Perl gives you some predefined filehandles: By default, all these filehandles are associated with the terminal.


Table of Contents.
Previous | Next.