=head1 NAME
-perlfaq5 - Files and Formats ($Revision: 1.17 $, $Date: 2002/05/23 19:33:50 $)
+perlfaq5 - Files and Formats ($Revision: 1.18 $, $Date: 2002/05/30 07:04:25 $)
=head1 DESCRIPTION
Some idioms can handle this in a single statement:
select((select(OUTPUT_HANDLE), $| = 1)[0]);
-
+
$| = 1, select $_ for select OUTPUT_HANDLE;
Some modules offer object-oriented access to handles and their
and use them in the place of named handles.
open my $fh, $file_name;
-
+
open local $fh, $file_name;
-
+
print $fh "Hello World!\n";
-
+
process_file( $fh );
Before perl5.6, you had to deal with various typeglob idioms
open FILE, "> $filename";
process_typeglob( *FILE );
process_reference( \*FILE );
-
+
sub process_typeglob { local *FH = shift; print FH "Typeglob!" }
sub process_reference { local $fh = shift; print $fh "Reference!" }