in reply to Re: Where am I going wrong ?
in thread Where am I going wrong with printing flatfile db records in alphabetical order?

Thanks, this worked:
@list = sort @list;

Replies are listed 'Best First'.
Re (3): Where am I going wrong ?
by dmmiller2k (Chaplain) on Oct 30, 2001 at 01:51 UTC

    Not to beat a dead horse too much, but is there any reason not to simply sort the list as it's read (which conserves memory, if THAT matters here)? To wit:

    open DATABASE, $mydata or die "Can't open $mydata: $!\n"; flock DATABASE, LOCK_EX or die "Can't lock $mydata: $!\n"; my @list = sort <DATABASE>; # NOTE ^^^^ close DATABASE; # which also unlocks it

    dmm

    
    You can give a man a fish and feed him for a day ...
    Or, you can teach him to fish and feed him for a lifetime