in reply to Sorting Question

Assuming you are storing your records as an array of references to your recrods, i.e.,
my @records = (['2004','4','23','other part of recrods'], ['2002','2','12','some other stuff']);
You can then sort them as:
@records = sort {$a->[0]<=>$b->[0] || $a->[1]<=>$b->[1] || $a->[2] <=> $b->[2]} @records;
Check the Cook book's array chapter for sorting methods.