perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike OK" <mike_...@acorg.com>
Subject Re: Sort issue
Date Mon, 14 Aug 2006 04:01:49 GMT
After a few off list hints and hours of searching and reading I have solved
the issue.  Here is the link to the page I found helpful.  Very belated
thanks (almost 6 years) goes to Stas Bekman.  Mike

http://www.gossamer-threads.com/lists/modperl/modperl/35645?search_string=so
rt%20subroutine;#35645


----- Original Message -----
From: "Mike OK" <mike_tmp@acorg.com>
To: <modperl@perl.apache.org>
Sent: August 13, 2006 11:32 AM
Subject: Sort issue


> Hi
>
>      I would like to do some custom sorting with some hash data that I
have
> stored.  It will be used in a mod_perl application so I would like to
ensure
> that the variables are safe and local.  My worry is that I plan to call a
> subroutine with sort but I have no idea how to pass the variables or if I
> even have to.  Here is what I am planning.  Any advice or links would
help.
> Thanks a lot.  Mike
>
> @sortedkeys = sort by_field keys(%names);
>
> sub by_fields {
>    my ($first_compare,$first_extra) = $names{$a};
>    my ($second_compare,$second_extra) = $names{$b};
>    ### I am spliting the value to sort on a secondary field other than the
> key
>    ($first_compare <=> $second_compare || $first_extra <=> $second_extra);
> }
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 2006-08-07
>
>


Mime
View raw message