Problems? Is your data what you think it is? | |
PerlMonks |
Re: Re: Re: changing the printing order of a dbby jsprat (Curate) |
on Jul 19, 2003 at 06:41 UTC ( [id://275834]=note: print w/replies, xml ) | Need Help?? |
localtime in scalar context returns a string something like "Fri Jul 18 23:35:45 2003" which won't sort cleanly. Build the key like "YYYYMMDDHHMMSS" and the keys will be sorted on disk.
Check the output, you'll see what I mean. The keys come out lexically sorted - the messages go from Message #1 to #50. Remember that you can have duplicate keys with $DB_BTREE. If two values are inserted with the same time stamp, there's no guarantee which way they will be retrieved (which is why I suggested $DB_RECNO). HTH
In Section
Seekers of Perl Wisdom
|
|