of this version of Perl therefore refers to "layers" rather than to
"disciplines". Now back to the regularly scheduled documentation...>
-To mark FILEHANDLE as UTF-8, use C<:utf8>.
+To mark FILEHANDLE as UTF-8, use C<:utf8> or C<:encoding(utf8)>.
+C<:utf8> just marks the data as UTF-8 without further checking,
+while C<:encoding(utf8)> checks the data for actually being valid
+UTF-8. More details can be found in L<PerlIO::encoding>.
In general, binmode() should be called after open() but before any I/O
is done on the filehandle. Calling binmode() will normally flush any
translates a list of numbers to the corresponding characters. And
- %hash = map { getkey($_) => $_ } @array;
+ %hash = map { get_a_key_for($_) => $_ } @array;
is just a funny way to write
%hash = ();
- foreach $_ (@array) {
- $hash{getkey($_)} = $_;
+ foreach (@array) {
+ $hash{get_a_key_for($_)} = $_;
}
Note that C<$_> is an alias to the list value, so it can be used to
the original list for which the BLOCK or EXPR evaluates to true.
If C<$_> is lexical in the scope where the C<map> appears (because it has
-been declared with C<my $_>) then, in addition to being locally aliased to
-the list elements, C<$_> keeps being lexical inside the block; i.e. it
+been declared with C<my $_>), then, in addition to being locally aliased to
+the list elements, C<$_> keeps being lexical inside the block; that is, it
can't be seen from the outside, avoiding any potential side-effects.
C<{> starts both hash references and blocks, so C<map { ...> could be either
%hash = map ( lc($_), 1 ), @array # evaluates to (1, @array)
-or to force an anon hash constructor use C<+{>
+or to force an anon hash constructor use C<+{>:
@hashes = map +{ lc($_), 1 }, @array # EXPR, so needs , at end
VERSION may be either a numeric argument such as 5.006, which will be
compared to C<$]>, or a literal of the form v5.6.1, which will be compared
-to C<$^V> (aka $PERL_VERSION. A fatal error is produced if VERSION is
+to C<$^V> (aka $PERL_VERSION). A fatal error is produced if VERSION is
greater than the version of the current Perl interpreter; Perl will not
attempt to parse the rest of the file. Compare with L</require>, which can
do a similar check at run time.
C<use>ing library modules that have changed in incompatible ways from
older versions of Perl. (We try not to do this more than we have to.)
+If the specified perl version is greater than or equal to 5.9.5, C<use
+VERSION> will also load the C<feature> pragma and enable all features
+available in the requested version. See L<feature>.
+
The C<BEGIN> forces the C<require> and C<import> to happen at compile time. The
C<require> makes sure the module is loaded into memory if it hasn't been
yet. The C<import> is not a builtin--it's just an ordinary static method