If you are processing text, you will regularly be opening, closing, reading from, and writing to files. In Perl, we use filehandles to get access to system files.
A filehandle is a name for a file, device, pipe, or socket. In Chapter 4, “Getting a Handle on Printing,” we discussed the three default filehandles, STDIN, STDOUT, and STDERR. Perl allows you to create your own filehandles for input and output operations on files, devices, pipes, or sockets. A filehandle allows you to associate the filehandle name with a system file and to use that filehandle to access the file.