Perl 3.0 PL4: ?: and arrays don't mix
Gregory N. Bond
gnb at bby.oz
Tue Nov 14 10:09:20 AEST 1989
There is a bug in perl 3.0 PL4 that appears on both Sun3/SunOs3.5 and
Sun4/SunOs 4.0, in that array refs in false conditionals are not
properly executed:
leo% ./perl -v
$Header: perly.c,v 3.0.1.1 89/11/11 04:50:04 lwall Locked $
Patch level: 4
Copyright (c) 1989, Larry Wall
Perl may be copied only under the terms of the GNU General Public License,
a copy of which can be found with the Perl 3.0 distribution kit.
leo% ./perl -e '@Z=("zero", "one", "two"); $var=0?"true":$Z[2];print "$var\n";'
zero
The false conditional is evaluated as $Z[0] for all values of the
subscript. And only in the false bit of a ?: statement. I have
mailed lwall this one, but I have no fix. Sorry.
--
Gregory Bond, Burdett Buckeridge & Young Ltd, Melbourne, Australia
Internet: gnb at melba.bby.oz.au non-MX: gnb%melba.bby.oz at uunet.uu.net
Uucp: {uunet,pyramid,ubc-cs,ukc,mcvax,prlb2,nttlab...}!munnari!melba.bby.oz!gnb
More information about the Comp.sources.bugs
mailing list