Using scalars for file handles came in with 5.6.1 as well, and yes, it is encouraged. Note that it requires that the variable be uninitialized. It makes it much easier to put file handes in an array or a hash.

I don't have my 3rd Edition of the Camel book here at home, but I'm pretty sure it's in there, although it's not in the 2nd edition. (The third edition is considerably larger, to accomodate the many additions to perl.)

The "perldoc perl561delta" command I mentioned previously gives this information as well, just ahead of the paragraph about 3-argument open(). It's also on the web at File and directory handles can be autovivified. It's nicely described with a concise example.

Using "open delta" as the search string at Perl documentation is an alternative to the "grep" method mentioned in my previous post. The header at that link says its 5.8 documentation, but the previous deltas are included. Searching the web version gives you an interface that's a lot prettier than what you get grepping the text of the perl docs, but the web interface doesn't show you the context lines in each file, so you can't go to the document you want as fast. I find both approaches helpful, for different needs, but either interface will do the job, according to your preference.


In reply to Re^2: File Handles by rodion
in thread File Handles by lustyx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.