develooper Front page | perl.perl5.porters | Postings from July 2008

[perl #56738] Re: Some bugs in Perl regexp (core Perl issues)

Thread Next
July 9, 2008 08:37
[perl #56738] Re: Some bugs in Perl regexp (core Perl issues)
Message ID:
# New Ticket Created by  Serge 
# Please include the string:  [perl #56738]
# in the subject line of all future correspondence about this issue. 
# <URL: >

Hello Christoph Bussenius,

 this is another bug in regexp: the special variable $^N does not work, when
a captured parenthesis has a quantifier. Example:

print "\$1=$1, \$^N=$^N, \$+=$+" if 'ab' =~ /(\w)/;

$1=a, $^N=a, $+=a

 This work well.

 Now with a quantifier:

print "\$1=$1, \$^N=$^N, \$+=$+" if 'ab' =~ /(\w)+/;

Use of uninitialized value in concatenation (.) or string at line ...
$1=b, $^N=, $+=b

 $^N is undefined! It is a bug.
 In case we write

my $a='bbb';
print "\$a=$a" if 'ab' =~ /(\w)+(?{ $a=$^N })/;

$a is undefined.

 I hope the both bugs I found will be fixed in the next Perl build, thanks.

Sincerely yours,

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About