Commit | Line | Data |
2304df62 |
1 | Article 20341 of comp.lang.perl: |
2 | Path: netlabs!news.cerf.net!mvb.saic.com!MathWorks.Com!news.kei.com!hookup!swrinde!gatech!taco.cc.ncsu.edu!taco.cc.ncsu.edu!setzer |
3 | From: setzer@math.ncsu.edu (William Setzer) |
4 | Newsgroups: comp.lang.perl |
5 | Subject: perl5a6 bug: sort sub @ary |
6 | Date: 30 Mar 94 13:49:20 |
7 | Organization: The Chebychev Church of Probability |
8 | Lines: 23 |
9 | Distribution: world |
10 | Message-ID: <SETZER.94Mar30134920@math.math.ncsu.edu> |
11 | NNTP-Posting-Host: math.ncsu.edu |
12 | |
13 | Ok, here's a weird one. Using the precompiled perl5a6 binary for the |
14 | sun, the following dumps core: |
15 | ---- |
16 | @S = (0, 1, 2, 3); |
17 | for ("A", "D", "b", "c") { $foo{$i++} = $_; } |
18 | # for (sort { lc($foo{$a}) cmp lc($foo{$b}) } @S) { print $foo{$_}, "\n"; } |
19 | for (sort Alpha @S) { print $foo{$_}, "\n"; } |
20 | |
21 | sub Alpha { lc($foo{$a}) cmp lc($foo{$b}); } |
22 | ---- |
23 | [Output] |
24 | Segmentation fault (core dumped) |
25 | ---- |
26 | However, if you comment out the "sort Alpha" and uncomment the "sort |
27 | {lc(...) cmp lc(...) }" line, everything works as expected. Also note |
28 | that if you uncomment both "sort"s, everything also works as expected. |
29 | Do-do-do-do [twilight zone music :-]. |
30 | |
31 | William |
32 | |
33 | PS: 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 | |