in reply to Re: Summary of Perl in the past 2-3 years
in thread Summary of Perl in the past 2-3 years
It includes advice as simple as using the three-argument form of open and lexical file handlesI'm sure you know this, but some readers may get the wrong impression. Neither three-argument open() nor lexical file handles dates from the last 2-3 years. Three arg open dates from 5.6 (released last millennium, when Perl6 was still a term referring to Chips aborted Topaz project).
"Lexical file handles" (or rather, references to file handles stored in a lexical variable) have been available for much longer. I don't have anything older than 5.005_04 at the moment, but I think they worked since 5.000. What was new in 5.6 (and that's what made them popular) was the autovivification of them. The following code uses "lexical file handles" and runs on pre-5.6 code:
use strict; local *FILE; my $fh = \*FILE; open $fh, "</etc/passwd" or die; while (<$fh>) { print; } __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Summary of Perl in the past 2-3 years
by moritz (Cardinal) on Apr 22, 2010 at 11:27 UTC |