Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!mailrus!ames!amdcad!pepsi!dwork From: dwork@pepsi.amd.com (Jeff Dwork) Newsgroups: comp.lang.perl Subject: Bug with splice in subroutine Message-ID: <29584@amdcad.AMD.COM> Date: 21 Mar 90 23:08:16 GMT Sender: news@amdcad.AMD.COM Reply-To: dwork@pepsi.AMD.COM (Jeff Dwork) Organization: Advanced Micro Devices, Inc. Sunnyvale CA Lines: 53 My sun3 dumps core on the following perl script. It works ok on a sun4. OS is 4.0.3. My heartfelt thanks to Larry for creating perl and to all you folks on the net that have helped me learn it. % perl bug.pl before subx 4 returning from subx Bus error (core dumped) % cat bug.pl #!/usr/local/bin/perl sub subx { local(@alx,@spalx,$x); # only @alx needs to be local for bug @alx = (1,2,3,4,5,6,7,8); @spalx = splice(@alx,0,5); # the following two lines could be just: print "$#spalx"; # the double quotes are essential for bug # print $x; and print $#spalx; work ok $x = $#spalx; print "$x"; print "\n"; print "returning from subx\n"; } print "before subx\n"; &subx; print "returned ok\n"; 1; % perl -v $Header: perly.c,v 3.0.1.4 90/02/28 18:06:41 lwall Locked $ Patch level: 14 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. ---- Jeff Dwork | 408-749-2356 | dwork@AMD.COM Advanced Micro Devices, M/S 45 |--------------------------------------- PO Box 3453 | The above opionions are mine, Sunnyvale, Ca 94088 | not AMD's. Jeff Dwork | 408-749-2356 | dwork@AMD.COM Advanced Micro Devices, M/S 45 |--------------------------------------- PO Box 3453 | The above opionions are mine, Sunnyvale, Ca 94088 | not AMD's.