home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!ames!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!fauern!fauna!cip.informatik.uni-erlangen.de!mnrausch
- From: mnrausch@cip.informatik.uni-erlangen.de (Martin Rausche)
- Subject: sorting problem
- Message-ID: <BxM5w2.Iyr@immd4.informatik.uni-erlangen.de>
- Sender: news@immd4.informatik.uni-erlangen.de
- Organization: Student Pool, CSD, University of Erlangen, Germany
- Date: Thu, 12 Nov 1992 17:28:50 GMT
- Keywords: sort
- Lines: 22
-
- I need a fast sorting routine for the following problem:
- I have a database and the entries look like this:
- keyword;author;title;owner
- My solution:
-
- sub byname
- {
- @ah=split(/;/,$a);
- @be=split(/;/,$b);
- shift(@ah);
- shift(@be);
- $ah=join(";",@ah);
- $be=join(";",@be);
- $ah cmp $be;
- }
-
- @data=sort byname @data;
-
- This is a very slow procedure, but how can I speed it up?
-
- Thanks in advance. Martin.
- (mnrausch@cip.informatik.uni-erlangen.de)
-