in reply to sorting flat file databases
Look at DBD::CSV. It allows you to treat a flat file as a database table and use SQL on it.
Read the table in then "select * from table order by entry_b"
I'm in the middle of something now. But, if I have time later I will update with an example.
Hope this helps,
-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."