first version of sort.pl