in reply to Segmentation fault

Segfaults are often caused by your script causing something internal within Perl to go into an infinite loop. Perl's generally smart enough to cope with your script looping infinitely, but can sometimes be tricked into an infinite loop and segfault in its internals.

An example script that causes a segfault in Perl 5.10 to 5.16 (and perhaps 5.17 as well?)

use 5.010; use strict; my $a = ['a', 'A']; my $b = ['b', $a, 'B']; push @$a, $b; say "hurrah!" if 'x' ~~ $a;

The smart match operator is tricked into switching between the two arrayrefs eternally. Each time it follows a reference between the arrays, the stack size grows a little bigger, until bang! Segfault!

Why your script in particular causes a segfault, we cannot determine without seeing it.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'