File Handling Package
If you are doing more than just simple I/O, then you’ll probably want to use the IO::Handle package. This package provides several useful functions that allow you to manipulate a file.
These functions allow you to do things such as seek to a given location in a file, truncate a file, get file status information (similar to the C stat(2) function), and other tasks.
For example, one problem with STDOUT is that it is buffered if you are writing to something other than the console. This normally is not a problem, but in some circumstances (such as writing to a pipe), this can be a problem.
The solution is to tell Perl to flush STDOUT after each output call. This is done using the autoflush method:
STDOUT–>autoflush(1);
For ...
Get Perl for C Programmers 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.