=head1 NAME perldelta - what is new for perl v5.9.5 =head1 DESCRIPTION This document describes differences between the 5.9.4 and the 5.9.5 development releases. See L, L, L, L and L for the differences between 5.8.0 and 5.9.4. =head1 Incompatible Changes =head1 Core Enhancements =head2 Regular expressions =over 4 =item Recursive Patterns It is now possible to write recursive patterns without using the C<(??{})> construct. This new way is more efficient, and in many cases easier to read. Each capturing parenthesis can now be treated as an independent pattern that can be entered by using the C<(?PARNO)> syntax (C standing for "parenthesis number"). For example, the following pattern will match nested balanced angle brackets: / ^ # start of line ( # start capture buffer 1 < # match an opening angle bracket (?: # match one of: (?> # don't backtrack over the inside of this group [^<>]+ # one or more non angle brackets ) # end non backtracking group | # ... or ... (?1) # recurse to bracket 1 and try it again )* # 0 or more times. > # match a closing angle bracket ) # end capture buffer one $ # end of line /x Note, users experienced with PCRE will find that the Perl implementation of this feature differs from the PCRE one in that it is possible to backtrack into a recursed pattern, whereas in PCRE the recursion is atomic or "possessive" in nature. =item Named Capture Buffers It is now possible to name capturing parenthesis in a pattern and refer to the captured contents by name. The naming syntax is C<< (?....) >>. It's possible to backreference to a named buffer with the C<< \k >> syntax. In code, the new magical hash C<%+> can be used to access the contents of the buffers. Thus, to replace all doubled chars, one could write s/(?.)\k/$+{letter}/g Only buffers with defined contents will be "visible" in the hash, so it's possible to do something like foreach my $name (keys %+) { print "content of buffer '$name' is $+{$name}\n"; } Users exposed to the .NET regex engine will find that the perl implementation differs in that the numerical ordering of the buffers is sequential, and not "unnamed first, then named". Thus in the pattern /(A)(?B)(C)(?D)/ $1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not $1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmer would expect. This is considered a feature. :-) =item Possessive Quantifiers Perl now supports the "possessive quantifier" syntax of the "atomic match" pattern. Basically a possessive quantifier matches as much as it can and never gives any back. Thus it can be used to control backtracking. The syntax is similar to non-greedy matching, except instead of using a '?' as the modifier the '+' is used. Thus C, C<*+>, C<++>, C<{min,max}+> are now legal quantifiers. =back =head1 Modules and Pragmas =head2 New Core Modules =head1 Utility Changes =head1 Documentation =head1 Performance Enhancements =head1 Installation and Configuration Improvements =head1 Selected Bug Fixes =head1 New or Changed Diagnostics =head1 Changed Internals =head1 Known Problems =head2 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://rt.perl.org/rt3/ . There may also be information at http://www.perl.org/ , 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