in reply to Tedious array sort revisited

sub mysort { chomp(my @entries = <STDIN>); return sort @entries; }
If you don't understand how sort() works, you can read more about it here. If you think sort() is not appropriate to use here, you'd better explain yourself.

Replies are listed 'Best First'.
Re: Re: Tedious array sort revisited
by gatornek (Initiate) on Feb 05, 2003 at 19:50 UTC
    I know that Perl is supposed to make the routine easy, but I'm specifically supposed to implement a sort subroutine without using any built in perl functions.

      Get thee to your nearest bookstore and get a copy of the wolf book (ISBN ISBN 1565923987), which has an entire chapter on sorting in perl without resorting to sort().

      If you have to re-invent the wheel, then please do yourself a favour and use some more efficient algorithm, e.g. a Quicksort or a Shell-sort.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law