perl 5.0 alpha 8
[p5sagit/p5-mst-13.2.git] / Bugs / lcsort
CommitLineData
2304df62 1Article 20341 of comp.lang.perl:
2Path: netlabs!news.cerf.net!mvb.saic.com!MathWorks.Com!news.kei.com!hookup!swrinde!gatech!taco.cc.ncsu.edu!taco.cc.ncsu.edu!setzer
3From: setzer@math.ncsu.edu (William Setzer)
4Newsgroups: comp.lang.perl
5Subject: perl5a6 bug: sort sub @ary
6Date: 30 Mar 94 13:49:20
7Organization: The Chebychev Church of Probability
8Lines: 23
9Distribution: world
10Message-ID: <SETZER.94Mar30134920@math.math.ncsu.edu>
11NNTP-Posting-Host: math.ncsu.edu
12
13Ok, here's a weird one. Using the precompiled perl5a6 binary for the
14sun, the following dumps core:
15----
16@S = (0, 1, 2, 3);
17for ("A", "D", "b", "c") { $foo{$i++} = $_; }
18# for (sort { lc($foo{$a}) cmp lc($foo{$b}) } @S) { print $foo{$_}, "\n"; }
19for (sort Alpha @S) { print $foo{$_}, "\n"; }
20
21sub Alpha { lc($foo{$a}) cmp lc($foo{$b}); }
22----
23[Output]
24Segmentation fault (core dumped)
25----
26However, if you comment out the "sort Alpha" and uncomment the "sort
27{lc(...) cmp lc(...) }" line, everything works as expected. Also note
28that if you uncomment both "sort"s, everything also works as expected.
29Do-do-do-do [twilight zone music :-].
30
31William
32
33PS: Does anyone actually care about these bug reports? I thought I
34 remember Larry saying that he preferred them in c.l.p., but it
35 wouldn't be the first time my memory has fritzed.
36
37