develooper Front page | perl.perl5.porters | Postings from December 2011

[perl #104162] Smart match that causes segfaults.

From:
James E Keenan via RT
Date:
December 4, 2011 16:28
Subject:
[perl #104162] Smart match that causes segfaults.
Message ID:
rt-3.6.HEAD-5084-1323044898-1162.104162-15-0@perl.org
On Mon Nov 21 02:05:57 2011, tobyink@cpan.org wrote:

> The following code segfaults in 5.10.1 and 5.14.2 (and presumably
> everything in between) on Linux and probably other platforms:
> 
> use 5.010;
> my $a = [qw/a A/];
> my $b = ['b', $a, 'B'];
> push @$a, $b;
> say 'hurrah' if 'B' ~~ $b;
> 

Note that if we switch the positions of 'b' and 'B' in the second
arrayref, the program DWIMs:

$ cat 104162.pl 
use feature qw( :5.10 );
my $x = [qw/a A/];
my $y = ['B', $x, 'b'];
push @$x, $y;
say 'hurrah' if 'B' ~~ $y;

$ perl 104162.pl 
hurrah




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About