=head1 NAME perldelta - what is new for perl v5.9.1 =head1 DESCRIPTION This document describes differences between the 5.9.0 release and the 5.9.1 release. =head1 Incompatible Changes =head1 Core Enhancements =head2 Lexical C<$_> The default variable C<$_> can now be lexicalized, by declaring it like any other lexical variable, with a simple my $_; The operations that default on C<$_> will use the lexically-scoped version of C<$_> when it exists, instead of the global C<$_>. In a C or a C block, if C<$_> was previously my'ed, then the C<$_> inside the block is lexical as well (and scoped to the block). In a scope where C<$_> has been lexicalized, you can still have access to the global version of C<$_> by using C<$::_>, or, more simply, by overriding the lexical declaration with C. =head2 Tied hashes in scalar context As of perl 5.8.2, tied hashes did not return anything useful in scalar context, for example when used as boolean tests: if (%tied_hash) { ... } The old nonsensical behaviour was always to return false, regardless of whether the hash is empty or has elements. There is now an interface for the implementors of tied hashes to implement the behaviour of a hash in scalar context, via the SCALAR method (see L). Without a SCALAR method, perl will try to guess whether the hash is empty, by testing if it's inside an iteration (in this case it can't be empty) or by calling FIRSTKEY. =head2 Formats Formats were improved in several ways. A new field, C<^*>, can be used for variable-width, one-line-at-a-time text. Null characters are now handled correctly in picture lines. Using C<@#> and C<~~> together will now produce a compile-time error, as those format fields are incompatible. L has been improved, and miscellaneous bugs fixed. =head2 The C<:unique> attribute is only meaningful for globals Now applying C<:unique> to lexical variables and to subroutines will result in a compilation error. =head2 Stacked filetest operators As a new form of syntactic sugar, it's now possible to stack up filetest operators. You can now write C<-f -w -x $file> in a row to mean C<-x $file && -w _ && -f _>. See L. =head1 Modules and Pragmata =over 4 =item Carp The error messages produced by C now include spaces between the arguments in function argument lists: this makes long error messages appear more nicely in browsers and other tools. =item Exporter C will now recognize grouping tags (such as C<:name>) anywhere in the import list, not only at the beginning. =item FindBin A function C is provided to resolve problems where modules in different directories wish to use FindBin. =item List::Util You can now weaken references to read only values. =item threads::shared C has a new two argument form. C has been added. =back =head1 Utility Changes C now assumes C<-print> as a default action. Previously, it needed to be specified explicitly. A new utility, C, makes it easy to run an individual regression test at the command line. C is part of Test::Harness, which users of earlier Perl versions can install from CPAN. =head1 Documentation The documentation has been revised in places to produce more standard manpages. The long-existing feature of C regexps setting C<$_> and pos() is now documented. =head1 Performance Enhancements =head1 Installation and Configuration Improvements =head1 Selected Bug Fixes =head2 UTF8 bugs Using substr() on a UTF8 string could cause subsequent accesses on that string to return garbage. This was due to incorrect UTF8 offsets being cached, and is now fixed. join() could return garbage when the same join() statement was used to process 8 bit data having earlier processed UTF8 data, due to the flags on that statement's temporary workspace not being reset correctly. This is now fixed. Using Unicode keys with tied hashes should now work correctly. chop() and chomp() used to mangle UTF8 strings. This has been fixed. =head2 Threading bugs Hashes with the C<:unique> attribute weren't made read-only in new threads. They are now. =head2 More bugs C<$a .. $b> will now work as expected when either $a or $b is C Reading $^E now preserves $!. Previously, the C code implementing $^E did not preserve C, so reading $^E could cause C and therefore C<$!> to change unexpectedly. Reentrant functions will (once more) work with C++. 5.8.2 introduced a bugfix which accidentally broke the compilation of Perl extensions written in C++ =head1 New or Changed Diagnostics The fatal error "DESTROY created new reference to dead object" is now documented in L. A new error, "%ENV is aliased to %s", is produced when taint checks are enabled and when *ENV has been aliased (and thus doesn't reflect the program's environment anymore.) =head1 Changed Internals =head1 Configuration and Building C now invokes callbacks regardless of the value of the variable they are called for. Previously callbacks were only invoked in the C branch. This change should only affect platform maintainers writing configuration hints files. =head1 New Tests =head1 Known Problems =head1 Platform Specific Problems =head1 Reporting Bugs If you find what you think is a bug, you might check the articles recently posted to the comp.lang.perl.misc newsgroup and the perl bug database at http://bugs.perl.org/ . There may also be information at http://www.perl.com/ , the Perl Home Page. If you believe you have an unreported bug, please run the B program included with your release. Be sure to trim your bug down to a tiny but sufficient test case. Your bug report, along with the output of C, will be sent off to perlbug@perl.org to be analysed by the Perl porting team. =head1 SEE ALSO The F file for exhaustive details on what changed. The F file for how to build Perl. The F file for general stuff. The F and F files for copyright information. =cut