I have a sorting question. Picture a datafile with about ten fields seperated by ‘:’.
The first field is unique and nummeric. As records are printed on the bottom of the datafile after a modification I would like to do a sort on the first field of the datafile to move the modified record to the right spot.
With the help of some manuals I tried something like this:
#sort prop
open (data, "<$profile" or &error("Unable to open the data file"
@data=<data>;
close(data);
@datax=split(/:/, $data);
@data = sort {$a <=> $b} @datax;
open (wdata, ">$profile" or &error("Unable to write to the data file"
print wdata @data;
close(wdata);
Obviously this is not correct as the whole database is deleted after this!
Hopefully there is somebody who can tell me what I'm doing wrong?
Jett [sig][/sig]
The first field is unique and nummeric. As records are printed on the bottom of the datafile after a modification I would like to do a sort on the first field of the datafile to move the modified record to the right spot.
With the help of some manuals I tried something like this:
#sort prop
open (data, "<$profile" or &error("Unable to open the data file"
@data=<data>;
close(data);
@datax=split(/:/, $data);
@data = sort {$a <=> $b} @datax;
open (wdata, ">$profile" or &error("Unable to write to the data file"
print wdata @data;
close(wdata);
Obviously this is not correct as the whole database is deleted after this!
Hopefully there is somebody who can tell me what I'm doing wrong?
Jett [sig][/sig]