marcos rebelo wrote:
For doing the Sort, you may consider the schwartzian_transformsub schwartzian_transform(&@) { my $compute = shift; return map { $_->[1] } sort { $a->[0] cmp $b->[0] } map { [ $compute->(), $_ ] } @_; } schwartzian_transform { (split /-/, $_)[1] } @array; More information on: http://sites.google.com/site/oleberperlrecipes/recipes/01-variables/02-arrays/03-sort-arrays?pli=1
That subroutine has a much too general name, because it only implements one way to create a temporary index (AKA Schwartzian Transform).
See also http://en.wikipedia.org/wiki/Schwartzian_transform and of course Sort::Maker. http://search.cpan.org/search?q=Sort::Maker -- Ruud -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
