http://qs321.pair.com?node_id=736578

madtoperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I want to get the output of this hash array sorted by date.

Input for the hasharray

$dateOut = "2008-12-05"; $dSec = 0; $dMin=5; $dHour=9;
$dateOut = "2008-12-03"; $dSec = 2; $dMin=8; $dHour=5;
$dateOut = "2008-12-04"; $dSec = 0; $dMin=5; $dHour=8;

This is the part of code,
$dateOut = "$oDay".'-'."$oMon".'-'."$oYear"; #print"Date out => $dateOut\n"; $Date_Time{$dateOut}{$dSec}{$dMin}{$dHour} = 1 +; #Retrieving the hash array output foreach my $date ( sort keys %Date_Time ) { #print"Date=> $date\n"; foreach my $sec (sort keys %{$Date_Time{$date}}) { #print"Seconds=> $sec\n"; foreach my $minute (sort keys %{$Date_Time{$date}{$sec}}) +{ #print"Minute=> $minute\n"; foreach my $ hour (sort keys %{$Date_Time{$date}{$sec} +{$minute}}) { print"Date=>[$date] --> [$hour]:[$minute]:[$sec]\n +"; } } } } My Output: Date=>04-12-2008 --> 8:5:0 Date=>03-12-2008 --> 5:8:0 Date=>05-12-2008 --> 9:5:0 Expected output: Date=>03-12-2008 --> 5:8:0 Date=>04-12-2008 --> 8:5:0 Date=>05-12-2008 --> 9:5:0
Could any of you please help me to display the hash data sorted by date?

Thanks,
madtoperl