Sorting String Problem
Posted: Fri Oct 18, 2002 3:35 am
Hi,
I am using a flat file text database system to store records of information. A sample in the file would look like this;
1#apple#10/10/02
2#banana#10/10/02
3#cherry#10/10/02
In order to remove items, I read the file per row into a list( ) and then skip the one to remove. I then have another array where I build up the non-skipped ones.
My problem is that I want to be able to sort on any of the 3 "columns" i.e the id, name or date.
When I have my final array $ar I issue a sort and because each element contains a string, it sorts on the id.
Can anyone suggest an alternative way of doing this? I don't really want to reorder the list but I guess I could???
Many thanks.
I am using a flat file text database system to store records of information. A sample in the file would look like this;
1#apple#10/10/02
2#banana#10/10/02
3#cherry#10/10/02
In order to remove items, I read the file per row into a list( ) and then skip the one to remove. I then have another array where I build up the non-skipped ones.
My problem is that I want to be able to sort on any of the 3 "columns" i.e the id, name or date.
When I have my final array $ar I issue a sort and because each element contains a string, it sorts on the id.
Can anyone suggest an alternative way of doing this? I don't really want to reorder the list but I guess I could???
Many thanks.