Stegalex has asked for the wisdom of the Perl Monks concerning the following question:
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; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 1: Variable will not stay shared in subroutine
by tilly (Archbishop) on Jan 09, 2002 at 03:43 UTC | |
|
Re: Variable will not stay shared in subroutine
by Juerd (Abbot) on Jan 09, 2002 at 03:28 UTC | |
by dmmiller2k (Chaplain) on Jan 09, 2002 at 21:37 UTC | |
|
(Ovid) Re: Variable will not stay shared in subroutine
by Ovid (Cardinal) on Jan 09, 2002 at 03:42 UTC | |
|
Re: Variable will not stay shared in subroutine
by Anonymous Monk on Aug 29, 2014 at 17:05 UTC | |
by choroba (Cardinal) on Aug 29, 2014 at 17:17 UTC | |
by Anonymous Monk on Feb 02, 2018 at 17:53 UTC | |
by choroba (Cardinal) on Feb 02, 2018 at 23:13 UTC | |
by LanX (Saint) on Feb 03, 2018 at 11:37 UTC |