Re: how to sort hash by value, where value is a valid date
- From: "J. Gleixner" <glex_no-spam@xxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 May 2005 14:50:06 -0500
perl_help_needed wrote:
Hi all, I want to sort a hash by its vlaue in perl. Value is a valid date. example: key value 48487 05/05/18 52327 05/05/23 64998 05/05/24 44147 05/05/18 ........etc.. here value can be any valid date in the format yy/mm/dd. Could anyone help me out with this one please!! Thanks..
What have you tried?
Due to the format, using 'sort' is fine.
my %h = ( 48487 => '05/05/18', 52327 => '05/05/23', 123 => '04/01/01');
print 'Sorted=', join(',', sort values %h), "\n";
Sorted=04/01/01,05/05/18,05/05/23perldoc -f values perldoc -q "How do I sort a hash"
.
- References:
- how to sort hash by value, where value is a valid date
- From: perl_help_needed
- how to sort hash by value, where value is a valid date
- Prev by Date: Re: numbers and strings and regex?
- Next by Date: Re: how to sort hash by value, where value is a valid date
- Previous by thread: Re: how to sort hash by value, where value is a valid date
- Next by thread: Re: how to sort hash by value, where value is a valid date
- Index(es):
Relevant Pages
|