Anirvan Chatterjee <[EMAIL PROTECTED]> wrote: :The following code hangs when run under perl 5.6.1. It runs just fine :under 5.005_03, and possibly other versions. : : my @strings = ('', '..'); : my @sorted = sort { : study $a; : return 1 if (($a =~ m/\w\.$/) && ($b !~ m/\.$/)); : return 0; : } @strings; : :This works fine if the study is removed. It also works fine outside :the context of a sort.
Thanks for the report. This bug has already been fixed in the latest development version, so 5.6.2 and 5.8.0 should both work correctly once they become available. Unfortunately I do not know of an easy workaround for this bug, except not to use study when your regexps are end-anchored (ie, have a '$' anchor). However, in the example code you show I would be surprised if the study() was gaining you anything - you may want to try doing some benchmarks against perl5.005_03 to verify. If you desperately need a fix for 5.6.1, the patch at: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-06/msg01000.html should apply at around line 1306 of util.c. Hope this helps, Hugo van der Sanden