<?xml version="1.0" encoding="windows-1252"?>
<node id="318983" title="Sorting by date" created="2004-01-05 19:33:14" updated="2004-08-22 16:41:27">
<type id="115">
perlquestion</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
I'm trying to print a table sorted by the date.  The date format I'm using is #.#.## or #.##.##.  For example $date = "1.13.04";.&lt;p&gt;

How can I get these to print in reverse order by date so the newest date is on top?  It may be confusing, but I have a whole mess of records in my SDBM that are dated, I need to bring them back out in a new order.&lt;p&gt;

The tricker part would be after seperating by date, how can I make it prints a new table for each month?  For example:


&lt;code&gt;
foreach (reverse sort keys %list) {
&lt;table&gt;
&lt;tr&gt;&lt;td&gt;1.1.04&lt;/td&gt;&lt;td&gt;first record&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1.21.04&lt;/td&gt;&lt;td&gt;next record, same month&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;table&gt;
&lt;tr&gt;&lt;td&gt;2.13.04&lt;/td&gt;&lt;td&gt;New table becuse it's a new month&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
}
&lt;/code&gt;

Any help would be very much appreciated.</field>
<field name="reputation">
9</field>
</data>
</node>
