gnb@bby.oz.au (Gregory N. Bond) (11/08/90)
This used to work on PL17, but now it coredumps....
@lines=( "EQO,ANZKA ,123,4,5,6,7,8,9", "EQO,BHPKA ,123,4,5,6,7,8,9" );
@lines = sort compfn @lines;
sub compfn {
local(@a, @b);
@a = split(/[,\t]/, $a);
@b = split(/[\t,]/, $b);
return 1 if substr($a[1], 0, 3) gt substr($b[1], 0, 3); # By cocode,
return -1 if substr($a[1], 0, 3) lt substr($b[1], 0, 3);
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# coredumps in this stmt
#
return 1 if ($a[7] > $b[7]); # Bu putness/callness
return -1 if ($a[7] < $b[7]);
return 1 if $a[4] > $b[4]; # By expiry
return -1 if $a[4] < $b[4];
return 1 if $a[6] > $b[6]; # By Strike
return -1 if $a[6] < $b[6];
return 0;
}
(dbx) Running: /usr/local/bin/perl optreport
signal SEGV (segmentation violation) in eval at 0x22a34
eval+0x7f04: ld [%o4 + 28], %o5
(dbx) where
eval() at 0x22a34
cmd_exec() at 0x4e98
cmd_exec() at 0x562c
sortsub() at 0x19e4c
qsort() at 0xf77aa6b4
do_sort() at 0x19db8
eval() at 0x211a4
eval() at 0x1acd4
cmd_exec() at 0x49f8
main() at 0x2c220
This is on sun3/4.0.3 and sun4/4.0.3, compiled with Sun CC.
--
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