in reply to Why am I get a core dump when I use ??{}

You can't use REGEXP in a CODE call from a main REGEXP, soo, your sub can't use REGEXP on it's code or it will mess with the main REGEXP, specially if the main REGEXP is from a while() loop.

But you can replace the use of regexp for other code.

Graciliano M. P.
"Creativity is the expression of the liberty".

  • Comment on Re: Why am I get a core dump when I use ??{}

Replies are listed 'Best First'.
Re: Re: Why am I get a core dump when I use ??{}
by Plankton (Vicar) on Apr 10, 2004 at 04:17 UTC
    Thanks gmpassos that was it! I changed my code to this ...
    ... use strict; my $countSpaces = sub { my $spaces = tr/ //; return qr{(?!)} if $spaces > 1; return qr{(?=)}; }; while (<DATA>) { chomp; print "$_ [", /(.*)(??{$countSpaces->()})/ ? "OK]\n" : "BAD]\n +"; } __DATA__ this line has more than one space that_is_5_spaces This isonespaceonly therearenospaceshere

    Plankton: 1% Evil, 99% Hot Gas.