[comp.lang.perl] scalar split can coredump

tchrist@convex.com (Tom Christiansen) (01/11/91)

This line makes perl dump core:

    perl -ne 'print unless split > 0'

This is the stack backtrace:

    _make_op(8009ea88,2,8009ea88,800962c8,0) from 0x8005859e [ap = ffffc500]
    _yyparse() from 0x80035aea [ap = ffffc8f0]
    _main(1,ffffca20,ffffca28) from ___ap$envret+0x26 [ap = ffffca0c]

What I'm trying to do here is split $_ into @_ 
and count the fields.  I had done this:

    print unless split;

But that didn't seem to work either (but no core dump), even 
though the man page states:

    If not in an array context, returns the number of fields found and
    splits into the @_ array.

So, Larry, is this a bug or am I confused?

--tom
--
"Hey, did you hear Stallman has replaced /vmunix with /vmunix.el?  Now
 he can finally have the whole O/S built-in to his editor like he
 always wanted!" --me (Tom Christiansen <tchrist@convex.com>)

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (01/11/91)

In article <1991Jan10.173933.26134@convex.com> tchrist@convex.com (Tom Christiansen) writes:
: 
: This line makes perl dump core:
: 
:     perl -ne 'print unless split > 0'

Fixed in 42.  The special code to parse the implied /\s+/ was clobbering
yacc's lookahead token subtype for >.

: What I'm trying to do here is split $_ into @_ 
: and count the fields.  I had done this:
: 
:     print unless split;
: 
: But that didn't seem to work either (but no core dump), even 
: though the man page states:
: 
:     If not in an array context, returns the number of fields found and
:     splits into the @_ array.
: 
: So, Larry, is this a bug or am I confused?

The latter bug seems to be unrelated.  I can't reproduce it here on
any of my machines.  It's either architecture specific or I've fixed it
already.

Larry