[comp.lang.perl] Array slicing bug

nwinton@iona.axion.bt.co.uk (Neil Winton) (02/19/90)

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

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/20/90)

In article <1990Feb19.112520.23521@axion.bt.co.uk> nwinton@iona.axion.bt.co.uk (Neil Winton) writes:
: 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.

Thanks, the fix was easy.

: 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 ...

And they have some good substitute for them, I suppose?

: Perhaps we might manage to get perl into POSIX some day (but not within
: the current balloting cycle!)

: *** This line intentionally left justified ***

Ouch!!!   How wonderfully garden pathological!

Well, my fire alarm just went off, so I better see if patch 9 is burning
up.

Larry