Hi John,

In article <[EMAIL PROTECTED]>, John W. Krahn wrote:
[...]
> perldoc -q filehandle
> 
> Found in /usr/lib/perl5/5.6.0/pod/perlfaq5.pod
>        How do I flush/unbuffer an output filehandle?  Why must I
>        do this?
> 
>        How can I make a filehandle local to a subroutine?  How do
>        I pass filehandles between subroutines?  How do I make an
>        array of filehandles?
> 
>        How can I use a filehandle indirectly?
> 
> Found in /usr/lib/perl5/5.6.0/pod/perlfaq7.pod
>        How can I pass/return a {Function, FileHandle, Array,
>        Hash, Method, Regex}?

Hmmm... lots to digest here. One question. An example mentioned is:

<Excerpt from="perldoc -q filehandle">
               As of perl5.6, open() autovivifies file and direc­
               tory handles as references if you pass it an
               uninitialized scalar variable.  You can then pass
               these references just like any other scalar, 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 type­
               glob idioms which you may see in older code.

                       open FILE, "> $filename";
                       process_typeglob(   *FILE );
                       process_reference( \*FILE );
</excerpt>

The Llama book, etc. teach using file handles (I think):
open FILE, "> $filename";       # etc.

But this mentions instead:
open my $fh, "> ", $filename;

"$fh" seems simpler (since I have only a passing idea of what globs are). 
Which should one be using? (If it makes a difference).

-K
-- 
Kevin Pfeiffer
International University Bremen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to