Lexical file handles

From: Tintin (tintin_at_invalid.invalid)
Date: 11/06/04


Date: Sat, 6 Nov 2004 14:17:01 +1300

Now that recent versions of Perl have lexical file handles, can anyone give
me some practical examples of why they are useful/better.

The only thing I can think of is that with 'use strict', you'll catch typos
in your filehandles, however I'm sure there's plenty of other reasons.



Relevant Pages

  • Re: Lexical file handles
    ... Tintin wrote: ... > Now that recent versions of Perl have lexical file handles, ... > anyone give me some practical examples of why they are useful/better. ...
    (comp.lang.perl.misc)
  • Re: Extreme beginner question on reading lines from a file.
    ... What is a lexical file handle? ... I'm working my way through Ford's "Perl Programming for the Absolute Beginner" and Lee's "Beginning Perl", and they both use the FH style of file handle. ... > line1 and line2 ... it does not use strict ...
    (perl.beginners)
  • Re: File handle re-use woes using pipe within a loop
    ... I recon its pretty similar to the pseudocode below, ... of perl to demonstrate exactly the below.. ... > mark@gowans.org (Mark Gowans) wrote: ... > I'd recommend using strict and lexical file handles, ...
    (comp.lang.perl.misc)
  • Re: convention regarding lexical filehandles
    ... :) Prior to the invention of lexical file handles, ... :) convention that filehandles should be given in all capital letters: ... :) consensus as towards this convention. ... There aren't many conventions in Perl which have reached 'consensus'. ...
    (comp.lang.perl.misc)
  • Re: Sorting and Writing Effecient Code
    ... >>> Perl closes any open filehandles when it exits anyway. ... x> lexical file handles are automatically closed when they go out of ... make anon handles for me and those also closed upon exiting scope. ...
    (comp.lang.perl.misc)