sub sort_results { #======================================== # Sort results in descending order # by date and ascending by document name # within a date. #======================================== my $self = shift; @{$self->{_search_hits}} = sort desc_by_date_asc_by_name @{$self->{_ +search_hits}}; sub desc_by_date_asc_by_name { $self->{_database}[$b]->{numeric_date} <=> $self->{_database}[$a]- +>{numeric_date} or $self->{_database}[$a]->{document_name} cmp $self->{_database}[$b] +->{document_name} or $a <=> $b; } }
In reply to Variable will not stay shared in subroutine by Stegalex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |