Chapter 4. Getting a Handle on Printing

Getting a Handle on Printing

The Filehandle

By convention, whenever your program starts execution, the parent process (normally a shell program) opens three predefined streams called stdin, stdout, and stderr. All three of these streams are connected to your terminal by default.

stdin is the place where input comes from, the terminal keyboard; stdout is where output normally goes, the screen; and stderr is where errors from your program are printed, also the screen.

Perl inherits stdin, stdout, and stderr from the shell. Perl does not access these streams directly but gives them names called filehandles. Perl accesses the streams via the ...

Get Perl by Example, Fourth 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.