in reply to sorting complex data

Two things come to mind right away ISO 8601 dates 20010720, 20010803 which will sort nicely or a bigger custom sorter.

sub bydashdate { my($ma,$da,$ya)=split('-',$data->{news}[$a]{date}); my($mb,$db,$yb)=split('-',$data->{news}[$b]{date}); $ya <=> $yb || $ma <=> $mb || $da <=> $db; #select in y, m, d order +the lower date } #you would call sort &bydashdate ( @{$data->{news}} )

This will break with your input if you have some old stuff from 99 around since that will sort after 00.

Also there are many date parsing modules around on CPAN which are probably overkill for this but if its gets more complex may be handy.