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'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.