Daniel Staal wrote: > > > Oh no! Its slower! I wrote a function implementing what is > > described above and its actually slower (about 1/2 as slow) than > > that huge thing I posted earlier. Does anything stand out here as > > being inefficient? Here it is: > > (First glance stuff:) > > > sub compare { > > my $a = shift; > > my $b = shift; > > If this is a 'real' sort operation this isn't necessary, and > shouldn't even work. Perl will do this for you.
This works only if 'compare' is prototyped sub compare($$); which is slower in itself. Since the prototyped subroutine is simply copying the parameters into $a and $b anyway it's much better to leave it without a prototype and let 'sort' set $a and $b implicitly. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>