Oops, I made perl segfault. All I was trying to do was assign a closure (which in turn calls another closure, which
The only reason I needed to assign my code to a typeglob is because I need a subroutine name so I can use it to sort by. It would really help if sort would take a subroutine reference but it doesn't it takes a block or a subroutine name. Grump.
Interestingly, if I twiddle things around a little bit, (eg adding a completely unrelated Data::Dumper::Dumper call) the segfault is sometimes there sometimes not. Sometimes I get "panic: memory wrap", sometimes a segfault, sometimes both, and sometimes "Bizarre copy of ARRAY in aassign at
* I've got no particular reason for that, other than the usual paranoia about
sort with code ref (Score:2)
It would really help if
sortwould take a subroutine reference but it doesn't it takes a block or a subroutine name. Grump.Thankfully, you're wrong.
sortis happy to take a code ref.That definitely would appear to work, correctly printing the numbers from 1 to 20 in reversed order, on any perl I throw it at, from 5.6.1 to 5.10.0.
Re: (Score:2)
Re: (Score:1)
Yeah, the
sortfunction has a bunch of terrible, horrible, awful special cases in place that are supposed to DWIM but end up surprising me much of the time I usesortotherwise than by passing an explicit, inline comparator block.