Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!ukc!axion!iona!nwinton From: nwinton@iona.axion.bt.co.uk (Neil Winton) Newsgroups: comp.lang.perl Subject: Array slicing bug Message-ID: <1990Feb19.112520.23521@axion.bt.co.uk> Date: 19 Feb 90 11:25:20 GMT Sender: news@axion.bt.co.uk Reply-To: nwinton@iona.axion.bt.co.uk (Neil Winton) Organization: British Telecom Research Labs Lines: 61 Ok, perl is wonderful, but there's still one or two rough edges. Here's my first contribution to the bug list. Array slices don't appear to honour the $[ variable. This seems to be reproducible on both a VAX and Sun 4. See the attached typescript. BTW, while I was taking part in the POSIX 1003.2 meetings we were putting another of Larry's children, patch, into the `User Portability Extension'. For a while the terms `hunk', `leading garbage' and `trailing garbage' were in there as good standard terms ... Perhaps we might manage to get perl into POSIX some day (but not within the current balloting cycle!) Neil E-Mail (UUCP) NWinton@axion.bt.co.uk (...!uunet!mcvax!axion.bt.co.uk!nwinton) Organisation British Telecom Research Laboratories (RT3134) Snail Mail 310 SSTF, BTRL, Martlesham Heath, IPSWICH IP5 7RE, UK Telephone +44 473 646079 (or +44 473 643210) *** This line intentionally left justified *** ------ Here beginneth the bug ... Script started on Mon Feb 19 11:07:34 1990 iona> cat bug.pl #!/usr/local/bin/perl $[ = 2; # Array base 2 @array = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); for ($i = 2; $i < ($[ + $#array); $i++) { print "\$array[$i] = $array[$i]\n"; } print join('->', @array[5 .. 10]) . "\n"; print join('->', @array[5, 6, 7, 8, 9, 10]) . "\n"; iona> perl bug.pl $array[2] = 1 $array[3] = 2 $array[4] = 3 $array[5] = 4 $array[6] = 5 $array[7] = 6 $array[8] = 7 $array[9] = 8 $array[10] = 9 $array[11] = 10 $array[12] = 6->7->8->9->10-> 6->7->8->9->10-> iona> perl -v $Header: perly.c,v 3.0.1.3 89/12/21 20:15:41 lwall Locked $ Patch level: 8 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. iona> script done on Mon Feb 19 11:07:57 1990