Perl-Sensitive Sunglasses | |
PerlMonks |
Re^2: File Handlesby rodion (Chaplain) |
on Mar 08, 2007 at 08:21 UTC ( [id://603782]=note: print w/replies, xml ) | Need Help?? |
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 Section
Seekers of Perl Wisdom
|
|