Perl binmode Function

Advertisements


Description

This function sets the format for FILEHANDLE to be read from and written to as binary on the operating systems that differentiate between the two. Files that are not in binary have CR LF sequences converted to LF on input, and LF to CR LF on output. This is vital for operating systems that use two characters to separate lines within text files (MS-DOS), but has no effect on operating systems that use single characters (Unix, Mac OS, QNX).

Syntax

Following is the simple syntax for this function:

binmode FILEHANDLE

Return Value

This function returns undef on failure or invalid FILEHANDLE and 1 on success.

Example

Following is the example code showing its basic usage:

#!/usr/bin/perl

When above code is executed, it produced following result




Advertisements
Advertisements