🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.bugs
Article #235

Perl 3.0 PL4: ?: and arrays don't mix

#235
From: Gregory N. Bond
Date: Mon, 13 Nov 1989 23:09
22 lines
1378 bytes
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@melba.bby.oz.au    non-MX: gnb%melba.bby.oz@uunet.uu.net
Uucp: {uunet,pyramid,ubc-cs,ukc,mcvax,prlb2,nttlab...}!munnari!melba.bby.oz!gnb
Technical Details
Message-ID: <GNB.89Nov14100920@baby.bby.oz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!samsung!munnari.oz.au!murtoa.cs.mu.oz.au!ditmela!yarra!melba.bby.oz.au!leo!gnb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!samsung!munnari.oz.au!murtoa.cs.mu.oz.au!ditmela!yarra!melba.bby.oz.au!leo!gnb
From: gnb@bby.oz (Gregory N. Bond)
Newsgroups: comp.sources.bugs
Subject: Perl 3.0 PL4: ?: and arrays don't mix
Message-ID: <GNB.89Nov14100920@baby.bby.oz>
Date: 13 Nov 89 23:09:20 GMT
Sender: news@melba.bby.oz.au
Organization: Burdett, Buckeridge and Young Ltd.
Lines: 22